We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f2b2b2 commit 499d2afCopy full SHA for 499d2af
problems/0860.柠檬水找零.md
@@ -397,6 +397,46 @@ object Solution {
397
}
398
399
```
400
+### C#
401
+```csharp
402
+public class Solution
403
+{
404
+ public bool LemonadeChange(int[] bills)
405
+ {
406
+ int five = 0, ten = 0, twenty = 0;
407
+ foreach (var bill in bills)
408
409
+ if (bill == 5) five++;
410
+ if (bill == 10)
411
412
+ if (five == 0) return false;
413
+ five--;
414
+ ten++;
415
+ }
416
+ if (bill == 20)
417
418
+ if (ten > 0 && five > 0)
419
420
+ ten--;
421
422
+ twenty++;
423
424
+ else if (five >= 3)
425
426
+ five -= 3;
427
428
429
+ else
430
431
+ return false;
432
433
+
434
435
436
+ return true;
437
438
+}
439
+```
440
441
442
<p align="center">
0 commit comments