上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 63 下一页
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /* 对于一个公共祖先(一定有子节点才 阅读全文
posted @ 2020-08-24 11:41 温暖了寂寞 阅读(122) 评论(0) 推荐(0) 编辑
摘要: int maxDepth(struct TreeNode* root){ if (root == NULL) { return 0; } int lenLeft = maxDepth(root->left) + 1; int lenRight = maxDepth(root->right) + 1; 阅读全文
posted @ 2020-08-24 09:29 温暖了寂寞 阅读(109) 评论(0) 推荐(0) 编辑
摘要: typedef struct TreeNode TreeNode; struct TreeNode* mirrorTree(struct TreeNode* root){ // recursion resolution if (root == NULL) return NULL; TreeNode 阅读全文
posted @ 2020-08-23 22:06 温暖了寂寞 阅读(69) 评论(0) 推荐(0) 编辑
摘要: bool findNumberIn2DArray(int** matrix, int matrixSize, int* matrixColSize, int target){ if (matrixSize == 0 || *matrixColSize == 0) { return false; } 阅读全文
posted @ 2020-08-23 19:07 温暖了寂寞 阅读(176) 评论(0) 推荐(0) 编辑
摘要: int hammingWeight(uint32_t n) { int res = 0; while (n != 0) { n = n & (n - 1); res++; } return res; } 阅读全文
posted @ 2020-08-23 18:35 温暖了寂寞 阅读(135) 评论(0) 推荐(0) 编辑
摘要: int count = 0; void func(int** arr,int* hash,struct TreeNode* node,int row) { row++; if (hash[row] == 0) //如果该行列数为0 那证明是当前遍历到的是该行第一个数(空值已经排除) { count+ 阅读全文
posted @ 2020-08-23 17:51 温暖了寂寞 阅读(160) 评论(0) 推荐(0) 编辑
摘要: //利用循环一直到空指针然后申请数组通过递归一层层赋值并返回int* reversePrint(struct ListNode* head, int* returnSize){ if(head == NULL){ *returnSize = 0; return malloc(sizeof(int) 阅读全文
posted @ 2020-08-22 18:56 温暖了寂寞 阅读(112) 评论(0) 推荐(0) 编辑
摘要: int num = 0; void fun(int n,int** arr,int row,int start,int index,int count,int k) { count++; //用来表示当前第几步 if (count > k) return; for (int i=0; i<row; 阅读全文
posted @ 2020-08-22 15:56 温暖了寂寞 阅读(159) 评论(0) 推荐(0) 编辑
摘要: struct ListNode* deleteNode(struct ListNode* head, int val){ int count = 0; struct ListNode* ret = head; struct ListNode* pre = head; while(head!=NULL 阅读全文
posted @ 2020-08-22 11:05 温暖了寂寞 阅读(103) 评论(0) 推荐(0) 编辑
摘要: #define MAX_INT 2147483647 int min (int a, int b) { return a < b? a: b; } typedef struct { int min[20001]; int stack[20001]; int top; } MinStack; /** 阅读全文
posted @ 2020-08-22 10:51 温暖了寂寞 阅读(106) 评论(0) 推荐(0) 编辑
上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 63 下一页