上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 63 下一页
摘要: void moveZeroes(int* nums, int numsSize){ int i=0,j; for(j=0;j<numsSize;j++) { if(nums[j] != 0) { if(i != j) { nums[i] = nums[j]; nums[j] = 0; } i++; 阅读全文
posted @ 2020-09-16 09:57 温暖了寂寞 阅读(108) 评论(0) 推荐(0) 编辑
摘要: int* numMovesStones(int a, int b, int c, int* returnSize){ int max=a,min=b,mid=c,temp; if(a < b) max=b,min=a; if (max < c) mid=max,max=c; else { if (m 阅读全文
posted @ 2020-09-16 09:01 温暖了寂寞 阅读(134) 评论(0) 推荐(0) 编辑
摘要: int repeatedNTimes(int* A, int ASize){ int hash[10001] = {0}; for(int i=0; i<ASize; i++) { if(++hash[A[i]] >=2) return A[i]; } return 0; } 阅读全文
posted @ 2020-09-16 00:47 温暖了寂寞 阅读(131) 评论(0) 推荐(0) 编辑
摘要: /*递归*/ void func(struct Node* root, int* arr,int* returnSize) { for (int i=0; i<root->numChildren; i++) { func(root->children[i],arr,returnSize); } ar 阅读全文
posted @ 2020-09-15 20:18 温暖了寂寞 阅读(137) 评论(0) 推荐(0) 编辑
摘要: /*递归*/ void func(struct Node* root, int* arr,int* returnSize) { arr[(*returnSize)++] = root->val; for (int i=0; i<root->numChildren; i++) { func(root- 阅读全文
posted @ 2020-09-15 17:57 温暖了寂寞 阅读(151) 评论(0) 推荐(0) 编辑
摘要: int tribonacci(int n){ if (n == 0) return 0; else if (n == 1 || n == 2) return 1; int t0=0, t1=1,t2=1,i,num=0; for (i=3; i<=n; i++) { num = t0 + t1 + 阅读全文
posted @ 2020-09-15 17:06 温暖了寂寞 阅读(99) 评论(0) 推荐(0) 编辑
摘要: int* nextGreaterElement(int* nums1, int nums1Size, int* nums2, int nums2Size, int* returnSize){ int hash[10000] = {0}; int i,j; for (i=0; i<nums2Size; 阅读全文
posted @ 2020-09-15 16:33 温暖了寂寞 阅读(115) 评论(0) 推荐(0) 编辑
摘要: bool canWinNim(int n){ return n % 4; } 阅读全文
posted @ 2020-09-15 15:59 温暖了寂寞 阅读(107) 评论(0) 推荐(0) 编辑
摘要: bool checkPossibility(int* nums, int numsSize){ int count=0,i; for (i=1; i<numsSize-1; i++) { if (i==1 && nums[i-1] > nums[i]) { nums[i-1] = nums[i]; 阅读全文
posted @ 2020-09-15 14:58 温暖了寂寞 阅读(146) 评论(0) 推荐(0) 编辑
摘要: int findComplement(int num){ int sum =0,pst=0; while(num){ if ((num & 1) == 0) { sum += pow(2,pst); } num >>= 1; pst++; } return sum; } 阅读全文
posted @ 2020-09-15 13:35 温暖了寂寞 阅读(149) 评论(0) 推荐(0) 编辑
上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 63 下一页