摘要: language: C address /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ 阅读全文
posted @ 2021-01-25 10:37 RougeBW 阅读(33) 评论(0) 推荐(0) 编辑
摘要: language: C 与主站34 基本一样 address // 先用二分法找到第一个,如果找不到,返回0个,找得到,再以此为起点左右计算数量 int search(int* nums, int numsSize, int target){ int low = 0,high = numsSize- 阅读全文
posted @ 2021-01-25 09:40 RougeBW 阅读(39) 评论(0) 推荐(0) 编辑
摘要: language: C address // 憨憨题,不解释 /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNod 阅读全文
posted @ 2021-01-25 09:28 RougeBW 阅读(54) 评论(0) 推荐(0) 编辑
摘要: language: C address // 除就完了 int hammingWeight(uint32_t n) { uint32_t a =2; uint32_t yu; int ans = 0; for(int i = 0;i < 32; i++){ yu = n%a; if(yu ==1) 阅读全文
posted @ 2021-01-25 09:22 RougeBW 阅读(35) 评论(0) 推荐(0) 编辑
摘要: language: C address // 很简单的递归 /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *righ 阅读全文
posted @ 2021-01-25 09:11 RougeBW 阅读(28) 评论(0) 推荐(0) 编辑
摘要: language: C address // nt题,不解释 /** * Note: The returned array must be malloced, assume caller calls free(). */ int* printNumbers(int n, int* returnSiz 阅读全文
posted @ 2021-01-25 09:03 RougeBW 阅读(31) 评论(0) 推荐(0) 编辑
摘要: language: C address // 考研做过,不解释 int majorityElement(int* nums, int numsSize){ int ans,count = 0; for(int i = 0; i < numsSize; i++){ if(count==0){ ans 阅读全文
posted @ 2021-01-25 08:58 RougeBW 阅读(36) 评论(0) 推荐(0) 编辑
摘要: language: C address bool isStraight(int* nums, int numsSize){ // 排序 void bubble_sort(int arr[], int size){ int i,j,key; for (i = 0; i < size ; i++){ f 阅读全文
posted @ 2021-01-25 08:47 RougeBW 阅读(19) 评论(0) 推荐(0) 编辑
摘要: language: C address /** * Note: The returned array must be malloced, assume caller calls free(). */ // 寻找第一个数的时候,遍历整个数组,然后为它找第二个数 // 找第二个数的时候使用二分查找 in 阅读全文
posted @ 2021-01-25 07:33 RougeBW 阅读(30) 评论(0) 推荐(0) 编辑
摘要: address /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ int kthLarg 阅读全文
posted @ 2021-01-25 01:23 RougeBW 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 同主站110 address /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ // 左 阅读全文
posted @ 2021-01-25 00:55 RougeBW 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 同主站54 address /** * Note: The returned array must be malloced, assume caller calls free(). */ int* spiralOrder(int** matrix, int matrixSize, int* matr 阅读全文
posted @ 2021-01-25 00:18 RougeBW 阅读(38) 评论(0) 推荐(0) 编辑