Maximum candies from boxes with keys
Some boxes are open and some are locked. Each box holds candies, keys to other boxes, and more boxes. You start with a few boxes. You may open a box once you have it and it is open or you hold its key. Return the most candies you can collect. Process boxes with a queue, and remember boxes you hold but cannot open yet, since a key may turn up later.
No answer yet. Write the first one; the best answer gets endorsed.
