digits is the decimal form of a non-negative number (it may start with zeros). One operation erases any single digit; the remaining digits keep their order. If every digit is erased, the number counts as 0.
Return the fewest erasures after which the number is divisible by 25.digits="93752" → 1
Erase the final 2: 9375 = 25 · 375.
digits="806" → 2
Neither 80, 86 nor 806 is divisible by 25. Erase 8 and 6 to leave 0.
digits="4" → 1
Erase the only digit, and the number becomes zero.
digits contains only the characters 0–9digits="93752"
1
Run checks the first 3 tests in your browser. Submit checks all 191 tests on the server, hidden ones included.