第一轮
Alien Dictionary [https://leetcode.com/problems/alien-dictionary]
第二轮
I give you a box
- A box can either be locked or unlocked
- Inside the box you will find: # candy, # inner boxes, # keys
- Keys correspond to specific boxes
- What is maximum number of candy you can retrieve?
- EXAMPLE
- I gave you box A
- A = { unlocked, 7 candy, boxes=[B, C], keys=[] }
- B = { locked, 5 candy, boxes=[D], keys=[] }
- C = { unlocked, 4 candy, boxes=[], keys=[B] }
- D = { locked, 100 candy, boxes=[], keys=[] }
- I give you box A, what is the maximum # of candy you can retrieve? 16
- HINT 1: Think, what are the conditions in which a box is “ready” to be opened?
- If you discover a new box and it is already unlocked
- I have previously found key X, and now I find locked box X
- I find key Y, and have already seen locked box Y
还是准备不够,最后挂了