<awangdev>739. Daily Temperatures_1.java
public int[] dailyTemperatures(int[] T) {
        int n = T.length;
        int[] rst = new int[n];
        Stack<Integer> stack = new Stack<>(); 
        
        for (int i = n - 1; i >= 0; i--) {
            int num = T[i];
            while (!stack.isEmpty() && num >= T[stack.peek()]) stack.pop();
            if (!stack.isEmpty() && num < T[stack.peek()]) rst[i] = stack.peek() - i;
            else rst[i] = 0;
            
            stack.push(i);
        }
        
        return rst;
    }
public int [ ] sample_funcname ( int [ ] var_0 ) {
  int var_2 = var_0 . length ;
  int [ ] var_3 = new int [ var_2 ] ;
  Stack < Integer > var_6 = new Stack < > ( ) ;
  for ( int var_8 = var_2 - 1 ;
  var_8 >= 0 ;
  var_8 -- ) {
    int var_10 = var_0 [ var_8 ] ;
    while ( ! var_6 . isEmpty ( ) && var_10 >= var_0 [ var_6 . peek ( ) ] ) var_6 . pop ( ) ;
    if ( ! var_6 . isEmpty ( ) && var_10 < var_0 [ var_6 . peek ( ) ] ) var_3 [ var_8 ] = var_6 . peek ( ) - var_8 ;
    else var_3 [ var_8 ] = 0 ;
    var_6 . push ( var_8 ) ;
  }
  return var_3 ;
}
