#3461

Check If Digits Are Equal in String After Operations I

newbie · 150 · lc easy +14 · 82.5% accepted · 345 likes · top 94%

Description

Given a digit string s, repeatedly condense it until only two digits remain: at each step, replace each adjacent pair with their sum mod 10, in left-to-right order.

Return true if the two surviving digits are equal, or false otherwise.

Code

1
2
3