HARDasked at 1 company

Check if an Original String Exists Given Two Encoded Strings

A hard-tier problem at 43% community acceptance, tagged with String, Dynamic Programming. Reported in interviews at BitGo and 0 others.

Founder's read

BitGo's asked this problem only once or twice in reports, but that's exactly why it lands in the blind spot. You've drilled DP problems, you know strings, so you assume this is standard reconstruction. It's not. The trick is that you're given two encoded versions of an unknown original string, and you need to prove the original exists by finding a valid decoding path that satisfies both constraints simultaneously. Most candidates miss that you can't decode greedily. Acceptance sits at 43%, which means nearly 6 in 10 people walk away empty. If this hits your live assessment and you blank on the state-space trick, StealthCoder solves it invisible to the proctor.

Companies asking
1
Difficulty
HARD
Acceptance
43%

Companies that ask "Check if an Original String Exists Given Two Encoded Strings"

If this hits your live OA

Check if an Original String Exists Given Two Encoded 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. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The problem forces you to think about DP as a graph of possibilities, not a linear sequence. You're not just decoding one string; you're validating that a single original could produce both encoded versions through two different encoding schemes. The naive approach tries to decode them independently, then compare. That fails because the constraints are interdependent. You need DP with memoization that tracks position in both encoded strings simultaneously, expanding at each cell whether to consume a digit from one, the other, or characters from both. The state is (position in encoded1, position in encoded2), and you're asking: can we reach (end, end) with a valid original. Common pitfall: forgetting that when you consume a digit, it represents a number 1-26 that maps to a letter, not a raw character. StealthCoder is the hedge if you blank on the recursive state definition during the live OA.

Pattern tags

The honest play

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

Check if an Original String Exists Given Two Encoded Strings recycles across companies for a reason. It's hard-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. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Check if an Original String Exists Given Two Encoded Strings interview FAQ

Is this actually a hard problem, or is it 'hard' because it's obscure?+

Obscurity drives the difficulty rating here. The algorithmic primitives (DP, memoization, state tracking) are medium-level, but the problem design forces you to see that you're matching two encoding streams in parallel. Most hard-ranked problems are hard because the state space is intricate. This one is hard because the framing tricks you.

Why does a company like BitGo ask this?+

BitGo works with cryptocurrency and cryptographic protocols. Encoding, decoding, and validation of parallel streams are real-world operations in their domain. They're screening for engineers who can think about constraints across multiple related sequences, not just single-pass problems.

What's the biggest mistake candidates make?+

Trying to decode both strings to a concrete original, then compare. You can't. Instead, you validate whether a valid original *could* exist by running DP on both simultaneously. The second mistake: not memoizing. The state space explodes without it, and brute force times out even on small inputs.

How does this combine String and Dynamic Programming?+

The string part is understanding digit-to-letter mapping (like 1='a', 26='z'). The DP part is the core: you're building a decision tree over two sequences and pruning branches that violate constraints. DP here is about valid state transitions, not optimal value computation.

Do I need to code both encodings, or is one given?+

Both are given as input. You receive two encoded strings and must determine if a single original string could produce both under their respective (implied or stated) encoding rules. The encoding rules are typically fixed, like numbers 1-26 mapping to letters a-z.

Want the actual problem statement? View "Check if an Original String Exists Given Two Encoded 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.