0 day streak
Anonymous · shared experience20 Apr 2026 · 3 views

Josh Technology Group: Cascading removal of adjacent letter pairs

Interview question #Josh Technology Group SDE 1 DSA / coding

Problem. Given a string, remove any two adjacent characters that are consecutive letters (like b and c) or circular neighbours (z and a). After a removal, the characters that become neighbours may also qualify, so removals cascade. Return the final string.

Approach discussed. A stack: push each character, and if it pairs with the top, pop instead. This handles the cascade in one pass.

Context. It was the first of two problems in a 90 minute technical interview for a campus role; the second was the tree version of house robber.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.