MEDIUMasked at 1 company

Split BST

A medium-tier problem at 82% community acceptance, tagged with Tree, Binary Search Tree, Recursion. Reported in interviews at Coupang and 0 others.

Founder's read

Split BST is a tree manipulation problem that shows up when you least expect it, and Coupang has asked it. The trick isn't hard once you see it, but the implementation can trip you up if you're not careful about how BST properties constrain your recursion. You're given a binary search tree and a value, and you need to split it into two trees: one with all nodes less than the value, one with nodes greater than or equal to it. High acceptance rate means the pattern is learnable, but you still need to think through the recursion cleanly. If you hit this live and blank on how to reconnect subtrees without breaking BST invariants, StealthCoder solves it in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
82%

Companies that ask "Split BST"

If this hits your live OA

Split BST 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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround.

Get StealthCoder
What this means

The naive approach is to traverse, collect nodes, and rebuild two trees. That works but misses the point. The real solution uses BST structure itself as your guide: at each node, compare the target value to decide which subtree to recurse into, then carefully reconnect the split subtrees to maintain BST properties. The hard part is tracking which subtree belongs to which half and reconnecting it correctly. Recursive calls return two trees, but you only recurse down one path at a time, so you need to handle the 'other' subtree by reattaching it to the appropriate half. Common pitfall: forgetting that when you split the right subtree, the non-matching part becomes the right child of the current node in the left result. This is why StealthCoder is the hedge if you freeze on the reconnection logic during the assessment.

Pattern tags

The honest play

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

Split BST recycles across companies for a reason. It's medium-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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Split BST interview FAQ

Is Split BST actually a MEDIUM, or is it harder?+

The 82% acceptance rate suggests it's solidly medium. The concept is simple, but the recursion and pointer reconnection require careful thinking. It's not a one-liner, and off-by-one mistakes in tree reassembly are common. Doable with 15-20 minutes of focused thinking.

Do I need to build both trees from scratch, or modify in place?+

You can do either, but the cleaner approach is to return two new tree pointers without modifying the original BST structure. In-place modification complicates pointer tracking. The problem doesn't usually require in-place, so stick with the cleaner pattern.

What's the trick to handling the subtree reconnection?+

When you recurse left (target is smaller), the current node and its right subtree belong to the right result tree. When you recurse right, the current node becomes the root of the right result, and you need to reattach the left subtree of the recursive result to it. Write out an example on paper first.

How does this relate to other tree topics like Recursion and Binary Tree?+

Recursion is the tool. Binary Tree skills teach you tree traversal. BST knowledge is critical because you exploit the ordering property to avoid scanning the whole tree. It combines all three, so if BST properties feel fuzzy, review those first.

Is this still asked at Coupang?+

It's on record as asked by Coupang. Tree problems stay on rotation at most tech companies. If you're interviewing there, it's worth knowing the pattern cold so you can code it cleanly under pressure.

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