摘要:
void rotate(int* nums, int numsSize, int k){ k %= numsSize; if (numsSize !=1 && k!=0) { int index = numsSize - k; int* p = (int*)malloc(numsSize*sizeo 阅读全文
摘要:
//异或满足交换律和结合律 int singleNumber(int* nums, int numsSize){ int result = 0; for (int i=0; i<numsSize; i++) result ^= nums[i]; return result; } 阅读全文
摘要:
int mySqrt(int x){ unsigned int i = 0; while(i * i < x) i++; if (i * i == x) return i; return --i; } 阅读全文
摘要:
int getSum(int a, int b){ while(a & b) { unsigned int val_and = a & b; //int val_and = a & b; int val_xor = a ^ b; val_and <<= 1; a = val_and; b = val 阅读全文
摘要:
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ bool IsSym(struct T 阅读全文