摘要:
454. 四数相加 II class Solution { public: int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) { int result = 阅读全文
摘要:
42. 接雨水 class Solution { public: int trap(vector<int>& height) { int n = height.size(); stack<int> st; st.push(0); int answer = 0; for(int i = 1; i < 阅读全文
摘要:
最后一块石头的重量 II class Solution { public: int lastStoneWeightII(vector<int>& stones) { int n = stones.size(); int s = reduce(stones.begin(), stones.end()) 阅读全文
摘要:
0-1背包 二维 #include <iostream> #include <vector> using namespace std; int main() { int m, n; cin >> m >> n; vector<int> weight(m + 1, 0); vector<int> va 阅读全文
摘要:
不同路径 class Solution { public: int uniquePaths(int m, int n) { int answer = 0; vector<vector<int>> dp(m, vector<int>(n, 0)); for(int i = 0; i < m; i++) 阅读全文