上一页 1 2 3 4 5 6 7 8 9 10 ··· 63 下一页
摘要: int lengthOfLIS(int* nums, int numsSize){ int len = 1, n = numsSize; if (n == 0) { return 0; } int* d= (int*)calloc(n+1,sizeof(int)); d[len] = nums[0] 阅读全文
posted @ 2020-12-29 16:54 温暖了寂寞 阅读(49) 评论(0) 推荐(0) 编辑
摘要: #define MAX(a,b) ((a) > (b) ? (a) :(b)) #define MIN(a,b) ((a) < (b) ? (a) :(b)) int computeArea(int A, int B, int C, int D, int E, int F, int G, int H 阅读全文
posted @ 2020-12-28 20:44 温暖了寂寞 阅读(89) 评论(0) 推荐(0) 编辑
摘要: int countNodes(struct TreeNode* root){ return (root)?countNodes(root->left)+countNodes(root->right)+1 :0; } 阅读全文
posted @ 2020-12-28 17:06 温暖了寂寞 阅读(77) 评论(0) 推荐(0) 编辑
摘要: int* majorityElement(int* nums, int numsSize, int* returnSize){ int* res =(int*)calloc(2,sizeof(int)); *returnSize=0; if (nums == NULL || numsSize == 阅读全文
posted @ 2020-12-28 16:28 温暖了寂寞 阅读(66) 评论(0) 推荐(0) 编辑
摘要: inline int partition(int* a, int l, int r) { int x = a[r], i = l - 1; for (int j = l; j < r; ++j) { if (a[j] <= x) { int t = a[++i]; a[i] = a[j], a[j] 阅读全文
posted @ 2020-12-27 22:34 温暖了寂寞 阅读(85) 评论(0) 推荐(0) 编辑
摘要: #define min(a,b) ((a)<(b))?(a):(b) int maximalSquare(char** matrix, int matrixSize, int* matrixColSize){ int* row = (int*)calloc(*matrixColSize, sizeo 阅读全文
posted @ 2020-12-27 21:59 温暖了寂寞 阅读(85) 评论(0) 推荐(0) 编辑
摘要: void recursion(int k,int n,int* returnSize,int* ColSize,int start,int cnt,int sum,int* temp,int** arr){ if(cnt==k){ if(sum==n){ arr[(*returnSize)]=(in 阅读全文
posted @ 2020-12-27 14:30 温暖了寂寞 阅读(49) 评论(0) 推荐(0) 编辑
摘要: #define max(a,b) ((a)>(b))?(a):(b); int rob(int* nums, int numsSize){ if(numsSize==1) return *nums; int dp[2][101]={0}; dp[0][0]=nums[0]; dp[0][1]=num 阅读全文
posted @ 2020-12-27 10:19 温暖了寂寞 阅读(34) 评论(0) 推荐(0) 编辑
摘要: int* findOrder(int numCourses, int** prerequisites, int prerequisitesSize, int* prerequisitesColSize, int* returnSize){ int** edges = (int**)calloc(nu 阅读全文
posted @ 2020-12-26 22:02 温暖了寂寞 阅读(79) 评论(0) 推荐(0) 编辑
摘要: int** edges; int* edgeColSize; int* visited; bool valid; void dfs(int u) { visited[u] = 1; for (int i = 0; i < edgeColSize[u]; ++i) { if (visited[edge 阅读全文
posted @ 2020-12-26 19:32 温暖了寂寞 阅读(53) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 63 下一页