Tag stack

2289. Steps to Make Array Non-decreasing

題目 LeetCode Problem You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i - 1] > nums[i] for all 0 < i < nums.length. Return the number of steps performed until nums becomes a non-decreasing array. 說明 這題我在看完 Hint 後才想出來,所以紀錄一下。 一個元素