码迷,mamicode.com
首页 > 编程语言 > 详细

LeetCode-739 Daily Temperatures Solution (with Java)

时间:2020-03-02 15:15:56      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:temp   col   ted   mic   ons   技术   bre   als   create   

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)

标签:temp   col   ted   mic   ons   技术   bre   als   create   

原文地址:https://www.cnblogs.com/sheepcore/p/12395404.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!