Algorithm · Rubrik · Hard
John and Mary are close friends. To test their bond, John challenges Mary with a puzzle. For a string s composed only of decimal digit characters, Mary may perform a move: pick an index i, take the digit d currently at s[i], remove it, and then place the digit $$\min(d + 1, 9)$$ at any position in the remaining string — at the very start, at the very end, or between any two adjacent characters. She may repeat this move as many times as she wants. Mary wants the…
Checking your access…