← All problemsSign in

1298. Maximum Candies You Can Get from Boxes

LeetCodeArrayBreadth-First SearchGraph TheoryOpen on judge ↗

You have n boxes labeled from 0 to n - 1. You are given four arrays: status, candies, keys, and containedBoxes where: - status[i] is 1 if the ith box is open and 0 if the ith box is closed, - candies[i] is the number of candies in the ith box, - keys[i] is a list of the labels of the boxes you can open after opening the ith box. - containedBoxes[i] is a list of the boxes you found inside the i

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start