Boxes, Keys & Candies (OOD)

Asked at Airbnb · Coding Questions · Difficulty: Medium · Last asked Jun 2, 2026

You are given a set of numbered boxes. Each box may be open or locked, holds some candies, and may contain keys to other boxes and other boxes inside it. Starting from a given set of boxes, open as many boxes as you can and collect as many candies as possible.

Loading the problem…