NeetCode #921LC-874MediumMath & Geometry
← Back to All Problems#921 · #874 · Walking Robot Simulation(模拟行走机器人)
📌 Problem Statement & Constraints
A robot starts at
(0, 0) facing north on an infinite plane containing obstacles at the given coordinates. It executes commands in order: a positive integer k moves it forward k units (stopping immediately if the next cell is blocked), -2 turns left 90 degrees, and -1 turns right 90 degrees. Return the maximum squared Euclidean distance from the origin that the robot reaches. Constraints: 1 <= commands.length <= 10^4, 0 <= obstacles.length <= 10^4, -3 * 10^4 <= xi, yi <= 3 * 10^4, obstacles are unique and never at the origin.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!