digits. It is folded in rounds until exactly two digits remain. In one round every pair of neighbouring digits is replaced by a single digit, the last digit of their sum, (a + b) mod 10; the new digits keep their order, so the string gets one shorter.
Return True if the two remaining digits are equal, and False otherwise.
The string can be very long, so simulating every round will be too slow.digits="505" → True
One round: (5 + 0) mod 10 = 5 and (0 + 5) mod 10 = 5. What is left is 55, two equal digits.
digits="1234" → False
1234 → 357 → 82. The digits 8 and 2 differ.
digits consists of digits onlydigits="505"
True
Run checks the first 3 tests in your browser. Submit checks all 110 tests on the server, hidden ones included.