Premium Only Content
1779 Find Nearest Point That Has the Same X or Y Coordinate
You are given two integers, x and y, which represent your current location on a Cartesian grid: (x, y). You are also given an array points where each points[i] = [ai, bi] represents that a point exists at (ai, bi). A point is valid if it shares the same x-coordinate or the same y-coordinate as your location.
Return the index (0-indexed) of the valid point with the smallest Manhattan distance from your current location. If there are multiple, return the valid point with the smallest index. If there are no valid points, return -1.
The Manhattan distance between two points (x1, y1) and (x2, y2) is abs(x1 - x2) + abs(y1 - y2).
##############
My other Leetcode solving videos (easy)
https://www.youtube.com/playlist?list=PLg9w7tItBlZt4oUpNyWU_0rOItlScu1_d
Leetcode solving videos (Medium):
https://www.youtube.com/playlist?list=PLg9w7tItBlZvMGxy-y1eXURPD6Ao6kkzA
Leetcode solving videos (Hard):
https://www.youtube.com/playlist?list=PLg9w7tItBlZt4JQmlkGD3M5idZn14NyL6
############
-
LIVE
We Like Shooting
15 hours agoWe Like Shooting 636 (Gun Podcast)
174 watching -
1:53:24
RiftTV
5 hours agoFBI Director Kash Patel Sues Elijah Schaffer for $5 MILLION?!
46.1K20 -
LIVE
DannyStreams
2 hours agoPutting this here until we get noticed
169 watching -
LIVE
SOLTEKGG
3 hours ago🔴LIVE - Battlefield 6 REDSEC (30+ KILL WORLD RECORD)
123 watching -
50:26
BonginoReport
10 hours agoElections Post-Mortem with Mayor Scott Singer - Nightly Scroll w/ Hayley Caronia (Ep.174)
86.1K22 -
DVR
XDDX_HiTower
3 hours agoARC RAIDERS, FIRST DROP IN
15.7K -
LIVE
Eternal_Spartan
13 hours ago🟢 Eternal Spartan Plays Resident Evil 8 | USMC Veteran
55 watching -
45:54
Donald Trump Jr.
8 hours agoGood Luck Chuck! The Left Lashes Out Over Shutdown Scheme's Failure | Triggered Ep.290
120K83 -
LIVE
Fragniac
4 hours ago🔵🟢🟡🔴 LIVE - FRAGNIAC - ARC RAIDERS - in Search of THE CLIP ( -_•)▄︻テحكـ━一💥
42 watching -
1:00:25
BIG NEM
9 hours agoDajana Gudic: Surviving the Bosnian War to Woke California
12.2K