ps:判断当前位置是否处于障碍物处,可以使用set(),但我来个剑走偏锋,哈哈。
class Solution:
def robotSim(self, commands: List[int], obstacles: List[List[int]]) -> int:
#东、南、西、北四个方向代号分别表示为:0、1、2、3
#东:+x,南:-y,西:-x,北:+y
move_x = [1,0,-1,0]
move_y = [0<