摘要: //C语言 typedef struct { int front; int back; int maxFront; int maxBack; int max[10001]; int queue[10001]; } MaxQueue; MaxQueue* maxQueueCreate() { MaxQ 阅读全文
posted @ 2020-12-02 19:09 温暖了寂寞 阅读(67) 评论(0) 推荐(0) 编辑
摘要: bool isOneBitCharacter(int* bits, int bitsSize){ for(int i=0; i<bitsSize; i++){ if(i==bitsSize-1 && bits[i]==0) return true; if(bits[i]==1) i++; } ret 阅读全文
posted @ 2020-12-02 16:18 温暖了寂寞 阅读(79) 评论(0) 推荐(0) 编辑
摘要: #define MAXLEN 10001 char * addBinary(char * a, char * b){ char* arr=(char*)calloc(MAXLEN+1,sizeof(char)); int right1=strlen(a)-1, right2=strlen(b)-1, 阅读全文
posted @ 2020-12-02 15:58 温暖了寂寞 阅读(78) 评论(0) 推荐(0) 编辑
摘要: int addDigits(int num){ while(num>=10){ int temp=0; while(num){ temp += num%10; num/=10; } num=temp; } return num; } 阅读全文
posted @ 2020-12-02 15:16 温暖了寂寞 阅读(56) 评论(0) 推荐(0) 编辑
摘要: #define MAXLEN 6000 char * addStrings(char * num1, char * num2){ char* arr=(char*)calloc(MAXLEN+1,sizeof(char)); int right1=strlen(num1)-1, right2=str 阅读全文
posted @ 2020-12-02 14:56 温暖了寂寞 阅读(89) 评论(0) 推荐(0) 编辑
摘要: int add(int a, int b){ long long temp; while(a){ temp = a&b; b = a^b; a=temp*2; } return b; } 阅读全文
posted @ 2020-12-02 14:14 温暖了寂寞 阅读(78) 评论(0) 推荐(0) 编辑
摘要: #define MAXLEN 10001 int* addToArrayForm(int* A, int ASize, int K, int* returnSize){ int* arr=(int*)calloc(sizeof(int),MAXLEN); int i, pst=MAXLEN, fla 阅读全文
posted @ 2020-12-02 12:14 温暖了寂寞 阅读(80) 评论(0) 推荐(0) 编辑
摘要: typedef struct { int front[2]; int rear[2]; int* arr[2][20001]; int noAnimal[2]; } AnimalShelf; AnimalShelf* animalShelfCreate() { AnimalShelf* obj=(A 阅读全文
posted @ 2020-12-02 10:46 温暖了寂寞 阅读(155) 评论(0) 推荐(0) 编辑
摘要: int arrangeCoins(int n){ int i; for(i=1; n>=0; i++) n-=i; return i-2; } 阅读全文
posted @ 2020-12-02 09:21 温暖了寂寞 阅读(72) 评论(0) 推荐(0) 编辑
摘要: /*C语言*/ int cmp(const void* a,const void* b){ return *(int*)a>*(int*)b; } int arrayPairSum(int* nums, int numsSize){ int sum=0, i; qsort(nums,numsSize 阅读全文
posted @ 2020-12-02 09:16 温暖了寂寞 阅读(75) 评论(0) 推荐(0) 编辑