You are in a city represented by a 2D array with several mcdonalds locations and must collect as many mcribs as possible by midnight (24 hours from now). Starting from "here", you can move one index (4 directionally adjacent) or stay put, each action will cost one hour of time. Upon visiting a mcdonalds location, you collect all the mcribs there, and they will respawn on the 4th hour mark. Additionally, there might be some hidden burger kings in the city. If you hit the burger king, you will instantly die. What is the maximum amount of McRibs can you collect? (Example attached) Describe an approach to return the answer given any input of N*M city grid. Looking for N*M*H time complexity. Will post solution when this post hits 12 hours old
All
The McRib restock component is really interesting, not sure how Iād solve it
BFS from here position and limited by the 4 hour constraint which really means you canāt traverse more than 4 edges. Just an idea
If thereās a McDās with 20 McRibs 5 edges away, you should traverse more than 4 though
Yeah we can generalize the k constraint. Iām not sure where the person respawns after reaching limit. If itās in a random location, this may have a probability component to it as well.
If die means itās over with no respawn, and the refresh is a 1 time thing on hour 4, then assuming you donāt hit a Burger King that is hidden wouldnāt it be 29 as you can get the 6mcribs twice and everything else once? Which given the question is maximum, that would be not hitting a BK before time is up.
How many have a working ice cream machine? I feel like we need to know this.
43
Nice š
Idk how to solve this but love it