classSolution{publicintlargestRectangleArea(int[] heights){int len = heights.length;int[] newH =newint[len+2];int index =1;for(int i =0; i < len;i++){
newH[index++]= heights[i];}
heights = newH;
len = heights.length;Stack<Integer> st =newStack<>();int res =0;
st.push(0);// 单调栈for(int i =0; i < len;i++){if(heights[i]>= heights[st.peek()]){
st.push(i);}else{while(heights[i]< heights[st.peek()]){int mid = st.peek();
st.pop();int left = st.peek();int right = i;int h = heights[mid];int width = right-left-1;
res =Math.max(res,h*width);}
st.push(i);}}return res;}}
3- ACM 实现
publicclass maxArea {publicstaticintmaxA(int[] heights){int len = heights.length;int[] newH =newint[len+2];int index =1;for(int i =1; i < len;i++){
newH[index++]= heights[i];}
heights = newH;
len = heights.length;Stack<Integer> st =newStack<>();int res =0;
st.push(0);// 单调栈for(int i =0; i < len;i++){if(heights[i]>= heights[st.peek()]){
st.push(i);}else{while(heights[i]< heights[st.peek()]){int mid = st.peek();
st.pop();int left = st.peek();int right = i;int h = heights[mid];int width = right-left-1;
res =Math.max(res,h*width);}
st.push(i);}}return res;}publicstaticvoidmain(String[] args){Scanner sc =newScanner(System.in);String input = sc.nextLine();
input = input.replace("[","").replace("]","");String[] parts = input.split(",");int[] nums =newint[parts.length];for(int i =0; i < nums.length;i++){
nums[i]=Integer.parseInt(parts[i]);}System.out.println("结果是"+maxA(nums));}}
数月前Axure RP官方已经发布了Axure RP 9的消息,并计划在今年夏天发布beta版本。新版Axure RP 9将是该工具向前迈出的重要一步,其中包括一系列广泛的改进:全面的UI修改,新的设计和文档功能以及前所未有的内部优化。我们已经彻底重…