EASYasked at 1 company

Find Valid Pair of Adjacent Digits in String

A easy-tier problem at 59% community acceptance, tagged with Hash Table, String, Counting. Reported in interviews at Oracle and 0 others.

Founder's read

You're iterating through a string looking for a pair of adjacent digits that satisfy some condition. Oracle's asked this. It's an easy problem with a 59% acceptance rate, which means half the candidates either overcomplicate it or miss an edge case on the live assessment. The trick isn't algorithmic complexity, it's understanding what "valid" actually means in the problem statement and then executing a clean hash table or counting solution without mistakes. If this lands in your OA and the wording trips you up, StealthCoder solves it invisibly in seconds so you can move on.

Companies asking
1
Difficulty
EASY
Acceptance
59%

Companies that ask "Find Valid Pair of Adjacent Digits in String"

If this hits your live OA

Find Valid Pair of Adjacent Digits in String is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The straightforward approach: scan the string, extract adjacent digit pairs, check validity against whatever criteria the problem defines, use a hash table or frequency counter to track pairs you've already seen or validate them. Most candidates get stuck on either misreading the validity condition or writing inefficient code that scans the string multiple times. The pattern is standard string traversal with a hash table overlay for O(1) lookups. Common pitfall: checking every pair against every other pair instead of using a set or counter to validate in a single pass. Since acceptance is under 60%, the edge cases are probably around empty strings, single characters, or the definition of adjacency itself. On game day, if the condition feels ambiguous, code the naive solution first, then optimize if needed. StealthCoder is your safety net if you blank on the hash table setup or validation logic.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Find Valid Pair of Adjacent Digits in String recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find Valid Pair of Adjacent Digits in String interview FAQ

Is this problem really easy, or is the 59% acceptance rate a trick?+

It's labeled easy, but the acceptance rate suggests the problem statement is ambiguous or candidates are overthinking the validity check. Read the condition twice. The algorithm itself, once you understand what valid means, is straightforward hash table or counting work.

Should I use a hash table, a set, or a frequency counter?+

Depends on what you're validating. If you need to count occurrences, use a dictionary or Counter. If you just need to track seen pairs, a set works. Either approach is O(n) time and O(1) space for typical digit pairs. Test both mentally before coding.

Why would Oracle ask an easy string problem in their OA?+

Easy doesn't mean worthless. It screens for clean coding and edge-case handling. A 59% acceptance rate at easy difficulty signals that sloppy implementation and misreading the problem cost candidates. Oracle probably uses it as a warm-up or to filter out candidates who rush.

What edge cases should I handle?+

Empty string, single character, no valid pairs, all pairs valid, and pairs that appear multiple times. Also confirm whether the string has non-digit characters. Code defensively and test boundary conditions before submitting.

Is this problem still being asked, or is it outdated?+

Oracle has reported it, and the data reflects recent hiring activity. It may rotate in and out of their OA pool. Either way, the hash table and string-counting pattern it tests is fundamental, so mastering it pays off across multiple problems.

Want the actual problem statement? View "Find Valid Pair of Adjacent Digits in String" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.