daysToFillJar 🌶️🌶️
You are filling a jar with coins to reach a goal. On day 1 you add 1 coin, on day 2 you add 2 coins, on day 3 you add 3 coins, and so on: one more each day.
Write a method daysToFillJar that takes the goal (0 or more) and returns the first day on which the jar holds at least goal coins. A goal of 0 takes 0 days.
For example, daysToFillJar(10) is 4 (1 + 2 + 3 + 4 = 10), and daysToFillJar(11) is 5.
Two numbers change each day: the day number, and the total in the jar. Which one do you add to the other?
Add the day number to the jar, then check the goal. If you let
day start at 1 and add before you increase it, are you off by one?