Lemonade Change — LeetCode

Soren Rood
Dec 17, 2020

This one stumped me at the beginning until I figured out I had to keep track of the bills. Once you start keeping track of bills, you just add cases and loop through the entire list until you are done.

Here’s the problem:

LeetCode #806

Here’s my solution to this:

https://carbon.now.sh

Something I just realized is that we can actually remove line 5, since we don’t need to keep track of the 20’s at all.

Here’s the submission report for the above code:

Faster than 82%

As usual my source code is located here and my social links are located here.

--

--