摘要:
超时的代码如下,主要思路是使用堆栈存储每个柱子的高度,然后用每一层减去上一个该高度所在位置 思路没问题就是超时了 class Solution { public: int trap(vector<int>& height) { int m =0; int l = height.size(); int 阅读全文
摘要:
自己使用堆栈没有成功,主要原因是很久没有敲代码,再加上没有演算整个过程,凭空想象,非常的不好 贴自己没成功的代码吧 class Solution { public: int longestValidParentheses(string s) { stack<string>temp; int numb 阅读全文
摘要:
大三放寒假一个月没有打代码了,简单题不会做,练练手 class Solution { public: int removeElement(vector<int>& nums, int val) { int left =0; int right =nums.size()-1; while(left<= 阅读全文