Closest Loot Box
CodeChefOpen on judge ↗
you are playing a pubg game. You are somewhere on the map, and there are lootboxes spread over the map. Given the position of all the loot boxes and your current position, find the closest lootbox to you in terms of Manhattan distance. That is, you can move around forward, backwards, left, and right, but not diagonally. If there are multiple possible closest lootboxes, return any of them. For ex
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.
Sign in to chat with the tutor and save your progress.
Sign in to start