摘要:
address /** * Note: The returned array must be malloced, assume caller calls free(). */ int* exchange(int* nums, int numsSize, int* returnSize){ int i 阅读全文
摘要:
可以用二分优化 address int missingNumber(int* nums, int numsSize){ int guiwei(int shu){ int a= nums[shu]; nums[shu] = shu; if((a>=0)&&(a<numsSize)) guiwei(a) 阅读全文
摘要:
address /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode *getIntersectionNode( 阅读全文
摘要:
address /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ // 带着深度递归 i 阅读全文
摘要:
address 需要优化 // 时间复杂度n^2 char firstUniqChar(char* s){ int getlen(char* s){ int i = 0; while(s[i] != '\0'){ i++; } return i; } int len = getlen(s); if( 阅读全文
摘要:
address int fib(int n){ if(n == 0) return 0; if(n == 1) return 1; int a[n+1]; a[0] = 0; a[1] = 1; for(int i = 2; i<=n; i++) a[i] = (a[i-1] + a[i-2])%1 阅读全文
摘要:
同主站154题 address int minArray(int* numbers, int numbersSize){ if(numbersSize == 1) return numbers[0]; int i = 0; while((i<numbersSize-1) && (numbers[i] 阅读全文
摘要:
address /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ /** * Note: The returned array must b 阅读全文
摘要:
同主战的70 address int numWays(int n){ if(n==0) return 1; int A[n+1]; A[0] = 1; A[1] = 1; for (int i = 2;i<= n;i++) A[i] = (A[i-1] + A[i-2])%1000000007; r 阅读全文
摘要:
address /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode* getKthFromEnd(struct 阅读全文