countBalancedTimes 🌶️🌶️
A digital clock shows the hour and the minute, like 7:05 or 12:21. Call a time balanced when the digits of the hour add up to the same total as the digits of the minute. For example, 12:21 is balanced (1 + 2 = 3, and 2 + 1 = 3), and 7:07 is balanced (7 and 0 + 7), but 7:08 is not.
Write a method countBalancedTimes that takes lastHour (from 0 to 23) and returns how many balanced times there are from 0:00 up to and including lastHour:59.
For example, countBalancedTimes(1) is 3: 0:00, 1:01 and 1:10.
Every hour has 60 minutes (0 through 59). Which loop should be outside, and which inside?
The digit sum of a number
x below 100 is a simple expression! How do you get the first and second digits of an up-to-two digit number?