package leetcode;

import java.util.Arrays;

public class Task739 {

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Task739().dailyTemperatures(new int[]{73, 74, 75, 71, 69, 72, 76, 73})));
    }

    public int[] dailyTemperatures(int[] temperatures) {
        int[] daysForWarmerWeather = new int[temperatures.length];
        for (int i = 0; i < temperatures.length - 1; i++) {
            for (int j = i + 1; j < temperatures.length; j++) {
                if (temperatures[j] > temperatures[i]) {
                    daysForWarmerWeather[i] = j - i;
                    break;
                }
            }
        }
        return daysForWarmerWeather;
    }
}

@@ -36,16 +36,51 @@
 .Arrays;
+%0Aimport java.util.stream.IntStream;
 %0A%0Apublic
@@ -339,162 +339,103 @@
     
-int%5B%5D daysForWarmerWeather = new int%5Btemperatures.length%5D;%0A        for (int i = 0; i %3C temperatures.length - 1; i++) %7B%0A            for (int j = i + 1; j %3C
+return IntStream.range(0, temperatures.length)%0A                .map(i -%3E IntStream.range(i + 1,
  tem
@@ -454,16 +454,9 @@
 ngth
-; j++) %7B
+)
 %0A   
@@ -472,12 +472,29 @@
     
-if (
+        .filter(j -%3E 
 temp
@@ -523,19 +523,21 @@
 ures%5Bi%5D)
- %7B%0A
+%0A    
         
@@ -552,40 +552,24 @@
     
-daysForWarmerWeather%5Bi%5D =
+.map(j -%3E
  j - i
-;
+)
 %0A   
@@ -589,19 +589,25 @@
     
-break;%0A    
+    .findFirst()%0A
     
@@ -606,34 +606,32 @@
 t()%0A            
-%7D%0A
             %7D%0A  
@@ -618,33 +618,43 @@
                 
-%7D
+.orElse(0))
 %0A        %7D%0A     
@@ -650,18 +650,16 @@
     
-%7D%0A
         
 retu
@@ -658,35 +658,18 @@
     
-return daysForWarmerWeather
+.toArray()
 ;%0A  

Use Functional Style