mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
@ -193,7 +193,7 @@ class Solution {
|
||||
否则的话,可以直接入栈。
|
||||
注意,单调栈里 加入的元素是 下标。
|
||||
*/
|
||||
Stack<Integer>stack=new Stack<>();
|
||||
Deque<Integer> stack=new LinkedList<>();
|
||||
stack.push(0);
|
||||
for(int i=1;i<lens;i++){
|
||||
|
||||
@ -217,7 +217,7 @@ class Solution {
|
||||
public int[] dailyTemperatures(int[] temperatures) {
|
||||
int lens=temperatures.length;
|
||||
int []res=new int[lens];
|
||||
Stack<Integer>stack=new Stack<>();
|
||||
Deque<Integer> stack=new LinkedList<>();
|
||||
for(int i=0;i<lens;i++){
|
||||
|
||||
while(!stack.isEmpty()&&temperatures[i]>temperatures[stack.peek()]){
|
||||
|
Reference in New Issue
Block a user