#3809
Best Reachable Tower
specialist · 795 · lc medium +31 · 55.6% accepted · 56 likes · top 49%
Description
Given a 2D array towers where towers[i] = [xi, yi, qi] describes position and quality, along with a center location and an integer radius, identify all towers whose Manhattan distance from center is at most radius and return the coordinates [xi, yi] of the one with the highest quality qi (ties broken by lexicographically smallest coordinate), or [-1, -1] if no tower is reachable.
Code
1
2
3