Tap here to switch tabs
Problem
Submissions

Problem: Check If Digits Are Equal in String After Operations II

Check If Digits Are Equal in String After Operations II repeatedly replaces adjacent digit pairs with their sum modulo ten. Return whether the final two digits match.

Statement

You are given a string s consisting of numerical digits.

You perform the following operation repeatedly until the length of s becomes 22:

  • Create a new string of length s.length −1- 1, where the digit at index i is calculated as (s[i] + s[i + 1]) modulo 1010.

  • Replace s with this newly created string.

Return true if the two remaining digits in s are identical, or false otherwise.

Constraints:

  • 3≤3 \leq s.length ≤105\leq 10^5

  • s consists of only digits.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If Digits Are Equal in String After Operations II

Check If Digits Are Equal in String After Operations II repeatedly replaces adjacent digit pairs with their sum modulo ten. Return whether the final two digits match.

Statement

You are given a string s consisting of numerical digits.

You perform the following operation repeatedly until the length of s becomes 22:

  • Create a new string of length s.length −1- 1, where the digit at index i is calculated as (s[i] + s[i + 1]) modulo 1010.

  • Replace s with this newly created string.

Return true if the two remaining digits in s are identical, or false otherwise.

Constraints:

  • 3≤3 \leq s.length ≤105\leq 10^5

  • s consists of only digits.