We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e907475 commit db56b09Copy full SHA for db56b09
Queue/621/solution1.js
@@ -6,5 +6,4 @@
6
* Medium
7
*/
8
const leastInterval = (tasks, n) => {
9
-
10
}
Stack/739/solution1.js
@@ -0,0 +1,25 @@
1
+/**
2
+ * https://leetcode-cn.com/problems/daily-temperatures/
3
+ *
4
+ * 739. 每日温度
5
+ * Medium
+ * 140ms 100.00%
+ * 42.6mb 44.44%
+ */
11
+const dailyTemperatures = T => {
12
+ const max = T.length;
13
+ const ans = new Array(max).fill(0);
14
+
15
+ const stack = [];
16
17
+ for (let i = 0, max = T.length; i < max; i++) {
18
+ while(stack.length && T[i] > T[stack[stack.length - 1]]) {
19
+ let index = stack.pop();
20
+ ans[index] = i - index;
21
+ }
22
+ stack.push(i);
23
24
+ return ans;
25
+}
0 commit comments