Tap here to switch tabs
Problem
Submissions

Problem: Check Adjacent Digit Differences

Check Adjacent Digit Differences asks you to inspect a digit string and return true only when every neighboring pair differs by no more than two. Return false if any pair exceeds that gap.

Statement

You are given a string s consisting solely of numerical digits.

Return true if the absolute difference between every pair of adjacent digits in s is at most 22, and false otherwise.

Constraints:

  • 2≤2 \leq s.length ≤100\leq 100

  • s consists only of digits.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check Adjacent Digit Differences

Check Adjacent Digit Differences asks you to inspect a digit string and return true only when every neighboring pair differs by no more than two. Return false if any pair exceeds that gap.

Statement

You are given a string s consisting solely of numerical digits.

Return true if the absolute difference between every pair of adjacent digits in s is at most 22, and false otherwise.

Constraints:

  • 2≤2 \leq s.length ≤100\leq 100

  • s consists only of digits.