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
############
-
23:24
MYLUNCHBREAK CHANNEL PAGE
12 hours agoDams Destroyed Turkey
64.8K62 -
LIVE
SpartanTheDogg
4 hours agoPro Halo Player
165 watching -
11:29
Tundra Tactical
4 hours ago $2.04 earnedGEN Z Brit 3D Prints a WORKING Gun Pt.3!
33.6K3 -
LIVE
AdmiralSmoothrod
6 hours agoark ascended - its dino time again
151 watching -
2:08:21
The Illusion of Consensus
9 days agoFormer FDA Official Dr. Philip Krause On White House Pressure To Approve Covid Vaccines at the FDA
52.7K35 -
LIVE
CHiLi XDD
5 hours ago[Sabatoge Saturday] Monster Hunter Wilds - w/ Dio!!
44 watching -
LIVE
RyuMuramasa✧
4 hours agoBlade of Vengeance | The First Berserker: Khazan | LIVE Playthrough!
54 watching -
1:50:26
Darkhorse Podcast
10 hours agoThere’s a New Tariff In Town: The 271st Evolutionary Lens with Bret Weinstein and Heather Heying
56.7K51 -
29:36
The Brett Cooper Show
3 days ago $5.09 earnedThe Non-Binary Samurai Game No One Wanted | Episode 19
51.8K41 -
4:25:56
GamerGril
9 hours agoFistful of GrilCheese 🤠How The West Was Won ðŸ¤
27.9K1