上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 63 下一页
摘要: int hammingWeight(uint32_t n) { int count=0; while(n) { if(n & 1) count++; n >>= 1; } return count; } 阅读全文
posted @ 2020-09-15 12:31 温暖了寂寞 阅读(113) 评论(0) 推荐(0) 编辑
摘要: int compare(const void* a, const void* b) { return *(int*)a > *(int*)b; } int numberOfBoomerangs(int** points, int pointsSize, int* pointsColSize) { i 阅读全文
posted @ 2020-09-15 11:58 温暖了寂寞 阅读(203) 评论(0) 推荐(0) 编辑
摘要: int numEquivDominoPairs(int** dominoes, int dominoesSize, int* dominoesColSize){ int hash[10][10] ={0},pair=0; for (int i=0; i<dominoesSize; i++) { ha 阅读全文
posted @ 2020-09-14 13:11 温暖了寂寞 阅读(150) 评论(0) 推荐(0) 编辑
摘要: int numIdenticalPairs(int* nums, int numsSize){ int hash[101] = {0}; int ret = 0; for(int i = 0; i < numsSize; i++) { hash[nums[i]]++; ret += hash[num 阅读全文
posted @ 2020-09-14 11:32 温暖了寂寞 阅读(139) 评论(0) 推荐(0) 编辑
摘要: int* numberOfLines(int* widths, int widthsSize, char * S, int* returnSize){ int i=0,row=1,total=0,len = strlen(S); int* arr = (int*)calloc(2,sizeof(in 阅读全文
posted @ 2020-09-14 11:14 温暖了寂寞 阅读(109) 评论(0) 推荐(0) 编辑
摘要: typedef struct { int arr[10001]; int n; int start; } RecentCounter; RecentCounter* recentCounterCreate() { RecentCounter* obj = (RecentCounter*)calloc 阅读全文
posted @ 2020-09-14 10:48 温暖了寂寞 阅读(152) 评论(0) 推荐(0) 编辑
摘要: int countSegments(char * s){ int count=0; char* tok; tok = strtok(s," "); while (tok) { count++; tok = strtok(NULL, " "); } return count; } 阅读全文
posted @ 2020-09-14 09:58 温暖了寂寞 阅读(149) 评论(0) 推荐(0) 编辑
摘要: int numberOfSteps (int num){ int count=0; while(num) { num = (num % 2)? num^1 : num>>1; count++; } return count; } 阅读全文
posted @ 2020-09-14 09:30 温暖了寂寞 阅读(152) 评论(0) 推荐(0) 编辑
摘要: int busyStudent(int* startTime, int startTimeSize, int* endTime, int endTimeSize, int queryTime){ int i, cnt = 0; for(i=0;i<startTimeSize;i++) cnt += 阅读全文
posted @ 2020-09-14 09:20 温暖了寂寞 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 给出第一个词 first 和第二个词 second,考虑在某些文本 text 中可能以 "first second third" 形式出现的情况,其中 second 紧随 first 出现,third 紧随 second 出现。对于每种这样的情况,将第三个词 "third" 添加到答案中,并返回答案 阅读全文
posted @ 2020-09-14 09:00 温暖了寂寞 阅读(119) 评论(0) 推荐(0) 编辑
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 63 下一页