EASYasked at 2 companies

Buddy Strings

A easy-tier problem at 34% community acceptance, tagged with Hash Table, String. Reported in interviews at DoorDash and 1 others.

Founder's read

Buddy Strings is the easy problem that catches candidates off guard because the acceptance rate sits at 33 percent. Despite the easy label, it's asked by real companies like DoorDash and Zoho during their online assessments. The trick isn't complex, but missing it costs you points. The problem asks whether two strings are buddies: one is a rotation of the other, or they're identical except for a single character swap. Most people either over-think the rotation check or miss edge cases entirely. If this problem hits your live OA and you blank on the two-case structure, StealthCoder surfaces a clean solution invisible to the proctor.

Companies asking
2
Difficulty
EASY
Acceptance
34%

Companies that ask "Buddy Strings"

If this hits your live OA

Buddy Strings 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 pattern splits into two independent checks. First, rotation: if string B is a rotation of string A, then B will always appear as a substring in A concatenated with itself (A plus A). The catch is length: both strings must be the same length or rotation is impossible. Second, the swap case: iterate both strings in parallel, count positions where characters differ, and verify exactly one difference. Common failures happen when candidates conflate the two cases, try to solve rotation with character counting, or forget to validate that a swap actually fixes the string. The hash table topic refers to tracking character frequency differences, though a simple position counter works fine. String manipulation and the rotation substring trick are the core skills here. If you nail both cases and handle length checks, this becomes straightforward.

Pattern tags

The honest play

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

Buddy Strings 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.

Buddy Strings interview FAQ

Why is the acceptance rate so low for an easy problem?+

The 33 percent rate reflects candidates missing edge cases: strings of different lengths, where swapping doesn't produce the other string, or misunderstanding what 'rotation' means. The two-case logic isn't hard, but rushing leads to incomplete solutions. A clear case-by-case approach fixes it.

What's the substring trick for rotation everyone talks about?+

If B is a rotation of A, then B appears in A + A. For example, 'ab' rotated is 'ba', and 'ba' is in 'abab'. Both strings must have equal length first. This avoids expensive rotation generation and is the cleanest way to check.

Do I need a hash table for this problem?+

Not necessarily. A hash table helps if you count character frequencies to detect swaps, but a simple two-pointer pass tracking mismatch positions is faster and clearer. The topic tag reflects character-comparison approaches, not a requirement.

Is this still asked at DoorDash and Zoho?+

Yes, both companies are on record asking it. The low acceptance rate and easy label make it a screening filter. Candidates who solve it cleanly often move forward, while those who stumble on edge cases get rejected outright.

What's the most common mistake candidates make?+

Forgetting that rotation and swap are two separate cases, or testing swap without verifying both strings end up identical. Another trap is assuming if strings differ by two characters, one swap fixes it. You must validate the swap actually produces equality.

Want the actual problem statement? View "Buddy Strings" 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.