<awangdev>Largest Rectangle in Histogram_1.java
public int largestRectangleArea(int[] heights) {
        if (heights == null || heights.length == 0) {
            return 0;
        }
        int n = heights.length;
        int max = 0;
        Stack<Integer> stack = new Stack<>(); 
        for (int i = 0; i <= n; i++) {
            int currHeight = i == n ? -1 : heights[i];
            while (!stack.isEmpty() && currHeight <= heights[stack.peek()]) {
                int currPeekHeight = heights[stack.pop()];
                int width = stack.isEmpty() ? i : i - stack.peek() - 1;
                max = Math.max(max, currPeekHeight * width);
            }
            stack.push(i);
        }

        return max;
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  int var_4 = var_0 . length ;
  int max = 0 ;
  Stack < Integer > var_8 = new Stack < > ( ) ;
  for ( int var_9 = 0 ;
  var_9 <= var_4 ;
  var_9 ++ ) {
    int var_11 = var_9 == var_4 ? - 1 : var_0 [ var_9 ] ;
    while ( ! var_8 . isEmpty ( ) && var_11 <= var_0 [ var_8 . peek ( ) ] ) {
      int var_15 = var_0 [ var_8 . pop ( ) ] ;
      int var_16 = var_8 . isEmpty ( ) ? var_9 : var_9 - var_8 . peek ( ) - 1 ;
      max = Math . max ( max , var_15 * var_16 ) ;
    }
    var_8 . push ( var_9 ) ;
  }
  return max ;
}
