package com.company;
import javax.swing.plaf.IconUIResource;
import java.util.*;
// 2022-02-13
class Solution {
public int[] dailyTemperatures(int[] temperatures) {
int[] res = 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]){
res[i] = j - i;
break;
}
}
}
// System.out.println(Arrays.toString(res));
return res;
}
}
public class Test {
public static void main(String[] args) {
new Solution().dailyTemperatures(new int[] {89,62,70,58,47,47,46,76,100,70}); // 输出: [8,1,5,4,3,2,1,1,0,0]
new Solution().dailyTemperatures(new int[] {73,74,75,71,69,72,76,73}); // 输出: [1,1,4,2,1,1,0,0]
new Solution().dailyTemperatures(new int[] {30,40,50,60}); // 输出: [1,1,1,0]
new Solution().dailyTemperatures(new int[] {30,60,90}); // 输出: [1,1,0]
}
}