LeetCode-739 Daily Temperatures Solution (with Java)

Posted sheepcore

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode-739 Daily Temperatures Solution (with Java)相关的知识,希望对你有一定的参考价值。

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 }

 

 

以上是关于LeetCode-739 Daily Temperatures Solution (with Java)的主要内容,如果未能解决你的问题,请参考以下文章

[LeetCode] 739. Daily Temperatures

LeetCode 739:每日温度 Daily Temperatures

LeetCode-739 Daily Temperatures Solution (with Java)

LeetCode 739. 每日温度 Daily Temperatures (Medium)

LeetCode 739. 每日温度 Daily Temperatures (Medium)

LeetCode 739. 每日温度