3931. Check Adjacent Digit Differences
You are given a string s consisting of digits. Return true if the absolute difference between every pair of adjacent digits is at most 2, otherwise return false. The absolute difference between a and b is defined as abs(a - b). Example 1: Input: s = "132" Output: true Explanation: - The absolute difference between digits at s[0] and s[1] is abs(1 - 3) = 2. - The absolute difference betwe
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start