503 Next Greater Element II
503. Next Greater Element II
1. Question
Input: [1,2,1]
Output: [2,-1,2]
Explanation:
The first 1's next greater number is 2;
The number 2 can't find next greater number;
The second 1's next greater number needs to search circularly, which is also 2.2. Implementation
3. Time & Space Complexity
Last updated