forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_739.java
More file actions
22 lines (20 loc) · 692 Bytes
/
_739.java
File metadata and controls
22 lines (20 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.fishercoder.solutions;
public class _739 {
public static class Solution1 {
public int[] dailyTemperatures(int[] temperatures) {
if (temperatures == null || temperatures.length == 0) {
return temperatures;
}
int[] result = new int[temperatures.length];
for (int i = 0; i < temperatures.length; i++) {
for (int j = i + 1; j < temperatures.length; j++) {
if (temperatures[j] > temperatures[i]) {
result[i] = j - i;
break;
}
}
}
return result;
}
}
}