Re: [闲聊] 每日leetcode

楼主: nh60211as   2024-08-15 18:44:30
860. Lemonade Change
原本想虾鸡巴乱写很复杂的程式码,后来想想还是简单比较好
class Solution {
public:
bool lemonadeChange(vector<int>& bills) {
int bill5 = 0;
int bill10 = 0;
// int bill20 = 0;
for(int bill : bills) {
int change = bill - 5;
if(change == 0) {
bill5++;
} else if(change == 5) {
if(bill5 ==0) {
return false;
}
bill5
作者: Smallsh (Smallsh)   2023-08-15 18:44:00
大师
作者: DJYOMIYAHINA (通通打死)   2024-08-15 18:54:00
大湿
作者: dont   2024-08-15 19:06:00
大师

Links booklink

Contact Us: admin [ a t ] ucptt.com