Skip to content

Practice Check If Digits Are Equal in String After Operations II

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3463
LeetCode Problem

Check If Digits Are Equal in String After Operations II

Problem Statement

Repeatedly replace the digit string s with the sums modulo 10 of its adjacent pairs, calculated simultaneously in left-to-right order. Each round shortens the string by one. Stop when exactly two digits remain and return whether they are equal.

Source: Check If Digits Are Equal in String After Operations II on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "3902"
Output
true

# Example 2

Input
s = "34789"
Output
false

Constraints

3 <= s.length <= 10^5
s consists of only digits.

Related LeetCode Problems

Practice more problems similar to Check If Digits Are Equal in String After Operations II.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.