You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #137 on September 15, 2026 11:12.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem link
https://leetcode.com/problems/lemonade-change/
Problem Summary
5달러로 레모네이드를 팔 때 거스름돈을 줄 수 있는지 판단하는 문제. 손님은 5, 10, 20 달러 지폐만 사용한다.
Solution
그냥 단순 시뮬레이션.
약간의 그리디도 들어가는데 20달러를 냈을 때 10달러가 있다면 10달러 포함해서 거슬러 주는게 무조건 이득이다.
나머지는 5달러로 거슬러 주고 5달러 지폐가 음수가 되면 False를 리턴하면 된다.
Source Code
All reactions