摘要: #define min(a,b) (a<b)?(a) :(b) int countBinarySubstrings(char * s){ int i, j, cnt = 0, len = strlen(s), sum=0, preVal=0, ret; for (i = 0; i < len; i+ 阅读全文
posted @ 2020-11-24 20:11 温暖了寂寞 阅读(58) 评论(0) 推荐(0) 编辑
摘要: int countGoodTriplets(int* arr, int arrSize, int a, int b, int c){ int i, j, k, cnt=0; for(i=0; i<arrSize-2; i++){ for(j=i+1; j<arrSize-1; j++){ if(ab 阅读全文
posted @ 2020-11-24 17:31 温暖了寂寞 阅读(115) 评论(0) 推荐(0) 编辑
摘要: int countNegatives(int** grid, int gridSize, int* gridColSize){ int i, j, cnt=0; for(i=0; i<gridSize; i++){ for(j=0; j<gridColSize[i]; j++){ if(grid[i 阅读全文
posted @ 2020-11-24 12:32 温暖了寂寞 阅读(79) 评论(0) 推荐(0) 编辑
摘要: int countOdds(int low, int high){ return (high - low) / 2 + (low % 2 || high % 2); } 阅读全文
posted @ 2020-11-24 12:05 温暖了寂寞 阅读(112) 评论(0) 推荐(0) 编辑
摘要: int countPrimes(int n) { unsigned char *map = (unsigned char *)calloc(n, sizeof(unsigned char)); int sq = (int)sqrt(n); for (int i = 2; i <= sq; i++) 阅读全文
posted @ 2020-11-24 11:47 温暖了寂寞 阅读(64) 评论(0) 推荐(0) 编辑
摘要: void visitTree( struct TreeNode * t , struct TreeNode * form , int * x , int * y , int depth ){ if( t == NULL ){ return ; } if( t -> val == *x ){ *x = 阅读全文
posted @ 2020-11-24 11:20 温暖了寂寞 阅读(124) 评论(0) 推荐(0) 编辑
摘要: int minOperations(char ** logs, int logsSize){ int i, cnt=0; for(i=0; i<logsSize; i++){ if(isalnum(logs[i][0])) cnt++; else if(strcmp(logs[i],"../") = 阅读全文
posted @ 2020-11-24 10:07 温暖了寂寞 阅读(72) 评论(0) 推荐(0) 编辑
摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ int* createTargetArray(int* nums, int numsSize, int* index, int indexS 阅读全文
posted @ 2020-11-24 09:51 温暖了寂寞 阅读(63) 评论(0) 推荐(0) 编辑
摘要: int* diStringMatch(char * S, int* returnSize){ int i, j, len = strlen(S), minVal = 0, maxVal = len; int* arr = (int*)calloc(len + 1, sizeof(int)); for 阅读全文
posted @ 2020-11-24 00:50 温暖了寂寞 阅读(57) 评论(0) 推荐(0) 编辑