摘要:
class Solution { public: int findNumberOfLIS(vector& nums) { if (nums.size() == 0) return 0; pair res = {0, 0}; // vector> dp(nums.size(), {1,1}); // pair: length, cou... 阅读全文
摘要:
slow: faster: 阅读全文
摘要:
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cla... 阅读全文
摘要:
class Solution { public: int numDecodings(string s) { int n = s.length(); if (n == 0) return 0; vector dp(n+1, 0); dp[0] = 1; for (int i = 0; i 0) { ... 阅读全文