InterviewLegend

Trees and Recursion

Alex Chen50 min readUpdated

Trees and recursion account for a good share of the coding problems Chewy candidates name. Intern and new-grad loops keep asking for plain binary search tree work, and phone screens and code tests add a twist or two.

Senior screens lean on backtracking, with follow-ups on what a null input does. Both backtracking problems here use the same recursion, where each call picks an item and hands the rest down. They differ in when a branch gets skipped.

On the tree problems, give each cost in terms of tree height and say what happens when sorted inserts turn the tree into a chain. On all of them, write the base case for an empty tree or a null string before the recursive case.

ChewyPremium lesson · Coding round

The 5 Chewy problems are below.

  1. A Premium questionCoding · Easy
  2. A Premium questionCoding · Easy
  3. A Premium questionCoding · Medium

+ 2 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Chewy questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your Chewy interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Chewy interview guide

Know what Chewy asks before you walk in.

30 coding · 1 system design · 28 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.