AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
You are visiting a farm with rows of fruit trees, and the i-th tree produces fruit of type `fruits[i]`. You start with two baskets and each basket can only carry one type of fruit. There is no limit on the amount of fruit per basket. You must pick exactly one fruit from every tree (including the start tree) while you walk to the right; you may not skip a tree, and you must stop once you reach a tree whose fruit doesn't fit in either basket. Return the maximum number of fruits you can pick.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.