摘要:
class Solution { public: long long f[1010][1010];//f[i][j]表示s前i个字符得到t前j个字符的所有方案 int numDistinct(string s, string t) { f[0][0]=1; int n=s.size(),m=t.si 阅读全文
摘要:
class Solution { public: int f[25][2010];//体积范围从-1000~1000 int findTargetSumWays(vector<int>& nums, int target) { int n=nums.size(),offset=1000;//价值总和 阅读全文
摘要:
class Solution { public: int f[110]; bool check(char a,char b) { if(a>='1'&&a<='9'&&b>='0'&&b<='9') { int c=a-'0'; c=c*10+(b-'0'); if(c>=1&&c<=26) ret 阅读全文
摘要:
/* // Definition for a Node. class Node { public: int val; Node* next; Node* random; Node(int _val) { val = _val; next = NULL; random = NULL; } }; */ 阅读全文
摘要:
暴力做法 时间复杂度 O (n^2) 遍历一遍,复制 next 指针,新建链表 遍历第二遍,复制 random 指针,查找每一个 random 节点的位置 class Solution { public: ListNode *copyRandomList(ListNode *head) { List 阅读全文