摘要:
int findMagicIndex(int* nums, int numsSize){ for (int i=0; i<numsSize; i++) { if (i == nums[i]) return i; } return -1; } 阅读全文
摘要:
int majorityElement(int* nums, int numsSize){ int key = nums[0]; int count = 0; for (size_t i = 0; i < numsSize; i++) { if(nums[i] == key) count++; el 阅读全文
摘要:
char * makeGood(char * s){ int pst=0,i,len=strlen(s); for (i=1; i<len; i++) { if (pst>=0 && abs(s[pst]-s[i]) == 32) pst--; else s[++pst] = s[i]; } s[p 阅读全文
摘要:
bool canBeEqual(int* target, int targetSize, int* arr, int arrSize){ int i,val=0,sum=0; for (i=0; i<targetSize; i++) { sum += target[i] - arr[i]; val 阅读全文
摘要:
int* masterMind(char* solution, char* guess, int* returnSize){ int* arr = (int*)calloc(2,sizeof(int)); int s_hash[26] = {0}; int g_hash[26] = {0}; int 阅读全文
摘要:
int cmp(const void* a, const void* b){ return (abs((*(int**)a)[0]) + abs((*(int**)a)[1])) - (abs((*(int**)b)[0]) + abs((*(int**)b)[1])); } int** allCe 阅读全文