Library Fine Slips
Easy · array
At the end of the month a library prints a reminder slip for each member who owes a fine. You are given the list fines, where each item is the amount one member owes, in pence, in the order the members appear on the register.
Work out the amounts to print:
- A member who owes 0 gets no slip, so leave that amount out.
- A member who owes less than 100 pence has 20 pence added for the cost of the reminder letter.
- A member who owes 100 or more pence prints the amount unchanged.
Return the list of amounts to print, in the same order as in fines. If nobody gets a slip, return an empty list.
Examples
Example 1
Input: fines = [0, 45, 250, 0, 99, 100]
Output: [65, 250, 119, 100]
The two 0s are left out. 45 becomes 65 and 99 becomes 119. 250 and 100 stay the same.
Example 2
Input: fines = [0, 0]
Output: []
Example 3
Input: fines = [7]
Output: [27]
Constraints
- 1 <= len(fines) <= 2000
- 0 <= fines[i] <= 10^4