摘要:
###1.填方格 class Solution { public: int M; int MOD=1e9+7; int dp[1006][255];//3*3*3*3*3=243 bool check(int t)//同一列上的状态不可以相同 { int last=-1;//对第一行,上一个状态为- 阅读全文
摘要:
原题链接 单调栈,首位各插入一个0,避免讨论栈为空的情况 class Solution { public: int largestRectangleArea(vector<int>& heights) { int ans=0; stack<int>st; //首位各自插入0,避免了讨论栈是否为空 h 阅读全文
摘要:
原题链接 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 class Solution { public: int trap(vector<int>& height) { int ans=0; int n=height.size(); if(n<3 阅读全文