Tap here to switch tabs
Problem
Submissions

Problem: Find Valid Pair of Adjacent Digits in String

Try to solve the Find Valid Pair of Adjacent Digits in String problem.

Statement

You are given a string s consisting of digits from ′1′'1' to ′9′'9'.

A pair of adjacent characters in s is considered valid if:

  • The two adjacent characters are not equal.

  • The total count of each character in s is equal to its numeric value.

Return the first valid pair of adjacent characters encountered from left to right. If no valid pair exists, return an empty string "".

Constraints:

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

  • s consists only of digits from ′1′'1' to ′9′'9'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Valid Pair of Adjacent Digits in String

Try to solve the Find Valid Pair of Adjacent Digits in String problem.

Statement

You are given a string s consisting of digits from ′1′'1' to ′9′'9'.

A pair of adjacent characters in s is considered valid if:

  • The two adjacent characters are not equal.

  • The total count of each character in s is equal to its numeric value.

Return the first valid pair of adjacent characters encountered from left to right. If no valid pair exists, return an empty string "".

Constraints:

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

  • s consists only of digits from ′1′'1' to ′9′'9'.