上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 63 下一页
摘要: int* plusOne(int* digits, int digitsSize, int* returnSize){ int i,carry=1; int* arr = (int*)calloc(digitsSize+1,sizeof(int)); for (i=digitsSize-1; i>= 阅读全文
posted @ 2020-09-12 11:47 温暖了寂寞 阅读(122) 评论(0) 推荐(0) 编辑
摘要: int** largeGroupPositions(char * s, int* returnSize, int** returnColumnSizes){ int len = strlen(s); int** arr = (int**)calloc(len/3,sizeof(int*)); int 阅读全文
posted @ 2020-09-12 10:20 温暖了寂寞 阅读(87) 评论(0) 推荐(0) 编辑
摘要: bool isPowerOfFour(int num){ return num > 0 && (num & (num - 1))== 0 && (num & 0xaaaaaaaa) == 0; } 阅读全文
posted @ 2020-09-11 18:24 温暖了寂寞 阅读(106) 评论(0) 推荐(0) 编辑
摘要: bool isPowerOfThree(int n){ // for (int i=0; pow(3,i)<=n; i++) // { // if (pow(3,i) == n) return true; // } // return false; return n > 0 && 116226146 阅读全文
posted @ 2020-09-11 17:43 温暖了寂寞 阅读(103) 评论(0) 推荐(0) 编辑
摘要: bool isPowerOfTwo(int n){ for (int i=0; i<31 && pow(2,i)<=n; i++) { if (pow(2,i) == n) return true; } return false; } bool isPowerOfTwo(int n){ return 阅读全文
posted @ 2020-09-11 16:40 温暖了寂寞 阅读(99) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void* a, const void* b) { return *(int*)a - *(int*)b; } int* powerfulIntegers(int x, int y, int bound, int* returnSize){ if (bound<2) { 阅读全文
posted @ 2020-09-11 15:31 温暖了寂寞 阅读(177) 评论(0) 推荐(0) 编辑
摘要: bool isprime(int count) { if (count ==1) return false; for (int j=2; j<=sqrt(count); j++) { if(count % j == 0) return false; } return true; } int numP 阅读全文
posted @ 2020-09-11 12:13 温暖了寂寞 阅读(150) 评论(0) 推荐(0) 编辑
摘要: bool isprime(int count) { if (count ==1) return false; for (int j=2; j<=sqrt(count); j++) if(count % j == 0) return false; return true; } int countPri 阅读全文
posted @ 2020-09-11 11:27 温暖了寂寞 阅读(154) 评论(0) 推荐(0) 编辑
摘要: #include <semaphore.h> class Foo { protected: sem_t firstJobDone; sem_t secondJobDone; public: Foo() { sem_init(&firstJobDone, 0, 0); sem_init(&second 阅读全文
posted @ 2020-09-11 10:08 温暖了寂寞 阅读(119) 评论(0) 推荐(0) 编辑
摘要: char * reverseOnlyLetters(char * S){ int len = strlen(S); int left=0,right=len-1; char ch; while(left<right) { if (isalpha(S[left]) && isalpha(S[right 阅读全文
posted @ 2020-09-11 09:27 温暖了寂寞 阅读(113) 评论(0) 推荐(0) 编辑
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 63 下一页