<gouthampradhan>stack_MaximalRectangle_1.java
private int getMaxRectangle(int[] heights) {
    int maxArea = Integer.MIN_VALUE;
    Stack<Integer> stack = new Stack<>();
    int i = 0;
    for (; i < heights.length; i++) {
      while (!stack.isEmpty() && heights[stack.peek()] >= heights[i]) {
        int top = stack.pop();
        int base = stack.isEmpty() ? i : i - stack.peek() - 1;
        maxArea = Math.max(maxArea, base * heights[top]);
      }
      stack.push(i);
    }
    while (!stack.isEmpty()) {
      int top = stack.pop();
      int base = stack.isEmpty() ? i : i - stack.peek() - 1;
      maxArea = Math.max(maxArea, base * heights[top]);
    }
    return maxArea;
  }
private int sample_funcname ( int [ ] var_0 ) {
  int var_3 = Integer . MIN_VALUE ;
  Stack < Integer > var_5 = new Stack < > ( ) ;
  int var_7 = 0 ;
  for ( ;
  var_7 < var_0 . length ;
  var_7 ++ ) {
    while ( ! var_5 . isEmpty ( ) && var_0 [ var_5 . peek ( ) ] >= var_0 [ var_7 ] ) {
      int var_12 = var_5 . pop ( ) ;
      int var_14 = var_5 . isEmpty ( ) ? var_7 : var_7 - var_5 . peek ( ) - 1 ;
      var_3 = Math . max ( var_3 , var_14 * var_0 [ var_12 ] ) ;
    }
    var_5 . push ( var_7 ) ;
  }
  while ( ! var_5 . isEmpty ( ) ) {
    int var_12 = var_5 . pop ( ) ;
    int var_14 = var_5 . isEmpty ( ) ? var_7 : var_7 - var_5 . peek ( ) - 1 ;
    var_3 = Math . max ( var_3 , var_14 * var_0 [ var_12 ] ) ;
  }
  return var_3 ;
}
