#3463

Check If Digits Are Equal in String After Operations II

grandmaster · 2315 · lc hard +32 · 14.2% accepted · 104 likes · top 0%

Description

Starting with a digit string s, reduce it by replacing each adjacent pair (left to right) with their digit sum modulo 10, until exactly two digits remain.

Return true if those two final digits match each other; otherwise return false.

Code

1
2
3