class Solution
{
public:
bool lemonadeChange(vector<int>& bills)
{
int five = , ten = ;
for (int i : bills)
{
if (i == ) five++;
else if (i == ) five--, ten++;
else if (ten > ) ten--, five--;
else five -= ;
if (five < ) return false;
}
return true;
}
};

扫描一遍,问题不大

860. Lemonade Change的更多相关文章

  1. 【Leetcode_easy】860. Lemonade Change

    problem 860. Lemonade Change solution class Solution { public: bool lemonadeChange(vector<int> ...

  2. [LeetCode&Python] Problem 860. Lemonade Change

    At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...

  3. 【LeetCode】860. Lemonade Change 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  4. [LeetCode] Lemonade Change 买柠檬找零

    At a lemonade stand, each lemonade costs $5.  Customers are standing in a queue to buy from you, and ...

  5. [Swift]LeetCode860. 柠檬水找零 | Lemonade Change

    At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...

  6. LeetCode-860. Lemonade Change

    At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...

  7. [LeetCode] 860. Lemonade Change_Easy tag: Greedy

    At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...

  8. LeetCode – Lemonade Change

    At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...

  9. C#LeetCode刷题之#860-柠檬水找零(Lemonade Change)

    问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/4036 访问. 在柠檬水摊上,每一杯柠檬水的售价为 5 美元. 顾 ...

随机推荐

  1. JS散度

    https://blog.csdn.net/weixinhum/article/details/85227476

  2. Unity3D游戏贪吃蛇大作战源码休闲益智手机小游戏完整项目

    <贪吃蛇大作战>一款休闲竞技游戏,不仅比拼手速,更考验玩家的策略. 视频演示: http://player.youku.com/player.php/sid/XMzc5ODA2Njg1Ng ...

  3. 大数据入门推荐 - 数据之巅 大数据革命,历史、现实与未来等五本PDF

    扫码时备注或说明中留下邮箱付款后如未回复请至https://shop135452397.taobao.com/联系店主

  4. 100-days: Two

    Title: London HIV patient's remission spurs hope for curing AIDS HIV 艾滋病毒  human immunodeficiency vi ...

  5. swift - 添加定时器

    mport UIKit /// 控制定时器的类 class ZDTimerTool: NSObject { /// 定时器 // private var timer: Timer? /// GCD定时 ...

  6. SeekBar

    <SeekBar android:id=”@+id/seek”android:layout_width=”match_parent”android:layout_height=”wrap_con ...

  7. java类中根据已有的变量复写类的toString方法

    java类中根据已有的变量复写类的toString方法: 在该类中定义好变量之后,shift+alt+s,从出现的列表中点击gemerate toString,就会自动生成对应的toString方法.

  8. 5O - 产生冠军

    有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛. 球赛的规则如下: 如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C. 如果A打败了B,B又打败了 ...

  9. windows2003服务器,时间每隔1小时自动同步一次

    有台服务器的时间总是不对,可能是电池快没电了吧,于是想让它时间保持更新状态,但又不想用第三方软件,在百度上查了一下,还真有方法 HKEY_LOCAL_MACHINE->SYSTEM->Cu ...

  10. sublime 注释模版插件DocBlockr的使用

    一.gihub地址 https://github.com/spadgos/sublime-jsdocs/ 其中有使用的教程可以参考 二.配置示例 安装教程此处略,请自行查找教程 jsdocs_extr ...