仔細找出要重複執行的條件,用 while 來處理 push/pop/enqueue/dequeue

常用指令

pop top

q = [1,2,3]
q.pop(0)
print(q) #[2,3]

remove first match

arr = [1,2,3,1]
arr.remove(1)
print(arr) #[2,3,1]

649. Dota2 Senate

739. Daily Temperatures

735. Asteroid Collision

496. Next Greater Element I

503. Next Greater Element II

394. Decode String

71. Simplify Path