1. Description:
2.Solutions:
1 /** 2 * Created by sheepcore on 2019-05-07 3 */ 4 class Solution { 5 public int[] dailyTemperatures(int[] T) { 6 int[] res = new int[T.length]; 7 for(int i = 0; i < T.length -1; i++){ 8 boolean hasWarmerDay = false; 9 for(int j = i + 1; j < T.length; j++){ 10 if(T[i] < T[j]){ 11 res[i] = j - i; 12 hasWarmerDay = true; 13 break; 14 } 15 } 16 if(!hasWarmerDay) 17 res[i] = 0; 18 } 19 res[T.length - 1] = 0; 20 return res; 21 } 22 }
原文地址:https://www.cnblogs.com/sheepcore/p/12395404.html
时间: 2024-10-30 12:58:34