comefrom: <awangdev>42. Trapping Rain Water_4.java
code: public int trap(int[] height) {
          if (height == null || height.length == 0) return 0;
          
          final Stack<Integer> stack = new Stack<>();
          int total = 0;
          stack.push(0);
          
          for (int i = 1; i < height.length; i++) {
              int curr = height[i];
              if (curr >= height[stack.peek()]) {
                  int bottom = height[stack.pop()];
                  while (!stack.isEmpty() && curr >= height[stack.peek()]) {
                      int leftBound = stack.pop(); 
                      total += (height[leftBound] - bottom) * (i - leftBound - 1); 
                      bottom = height[leftBound]; 
                  }
                  if (!stack.isEmpty() && curr < height[stack.peek()]) {
                      total += (curr - bottom) * (i - stack.peek() - 1);
                  }
              }
              stack.push(i);
          }
          return total;   
      }
masked: public int sample_funcname ( int [ ] var_0 ) {
    if ( var_0 == null || var_0 . length == 0 ) return 0 ;
    final Stack < Integer > var_6 = new Stack < > ( ) ;
    int var_7 = 0 ;
    var_6 . push ( 0 ) ;
    for ( int var_10 = 1 ;
    var_10 < var_0 . length ;
    var_10 ++ ) {
      int var_11 = var_0 [ var_10 ] ;
      if ( var_11 >= var_0 [ var_6 . peek ( ) ] ) {
        int var_14 = var_0 [ var_6 . pop ( ) ] ;
        while ( ! var_6 . isEmpty ( ) && var_11 >= var_0 [ var_6 . peek ( ) ] ) {
          int var_16 = var_6 . pop ( ) ;
          var_7 += ( var_0 [ var_16 ] - var_14 ) * ( var_10 - var_16 - 1 ) ;
          var_14 = var_0 [ var_16 ] ;
        }
        if ( ! var_6 . isEmpty ( ) && var_11 < var_0 [ var_6 . peek ( ) ] ) {
          var_7 += ( var_11 - var_14 ) * ( var_10 - var_6 . peek ( ) - 1 ) ;
        }
      }
      var_6 . push ( var_10 ) ;
    }
    return var_7 ;
  }
  