上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 63 下一页
摘要: bool divisorGame(int N){ return (N%2)?false :true; } 阅读全文
posted @ 2020-11-19 10:54 温暖了寂寞 阅读(123) 评论(1) 推荐(0) 编辑
摘要: void duplicateZeros(int* arr, int arrSize){ int* ans = (int*)calloc(arrSize+1,sizeof(int)); int i,pst=0; for(i=0; i<arrSize && pst<arrSize; i++){ ans[ 阅读全文
posted @ 2020-11-19 09:55 温暖了寂寞 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 一、概念 R-B Tree,全称是Red-Black Tree又称红黑树,它是一种特殊的二叉查找树,红黑树的每个节点上都有存储位表示节点的颜色,可以是红或黑。 二、特性 1、每个节点或者是红色,或者是黑色 2、根节点是黑色的 3、每个叶子节点(NIL)是黑色的。注意:这里的叶子节点,是指为空的叶子节 阅读全文
posted @ 2020-11-17 11:30 温暖了寂寞 阅读(643) 评论(0) 推荐(0) 编辑
摘要: typedef struct st{ int pst; int* arr; }st; #define min(a,b) (a)<(b)?(a):(b) int findRotateSteps(char * ring, char * key){ int i,j,k,minStep=100000,val 阅读全文
posted @ 2020-11-11 20:47 温暖了寂寞 阅读(131) 评论(0) 推荐(0) 编辑
摘要: int recursion(struct TreeNode* root, bool* flag){ if (!root || *flag=false) return 0; int left=recursion(root->left,flag); int right=recursion(root->r 阅读全文
posted @ 2020-11-10 16:57 温暖了寂寞 阅读(66) 评论(0) 推荐(0) 编辑
摘要: #define mod 1000000007 int breakfastNumber(int* staple, int stapleSize, int* drinks, int drinksSize, int x){ int cnt[100001] = {0}; for (int i=0; i<dr 阅读全文
posted @ 2020-11-10 16:09 温暖了寂寞 阅读(178) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void* a, const void* b){ return *(int*)a-*(int*)b; } void nextPermutation(int* nums, int numsSize){ int i,left,pst=0,val,temp; int* arr= 阅读全文
posted @ 2020-11-10 11:50 温暖了寂寞 阅读(71) 评论(0) 推荐(0) 编辑
摘要: int exchangeBits(int num){ double i = 0; int even, ood; int val = num; while (val){ even = num & (int)pow(2.0,i); ood = num & (int)pow(2.0, i + 1); if 阅读全文
posted @ 2020-11-10 00:21 温暖了寂寞 阅读(85) 评论(0) 推荐(0) 编辑
摘要: int maxLengthBetweenEqualCharacters(char * s){ int maxLen = -1; int tmpLen = -1; int hash[128]; if (s == NULL || strlen(s) < 2) return -1; // 初始化字典值 m 阅读全文
posted @ 2020-11-09 16:08 温暖了寂寞 阅读(176) 评论(0) 推荐(0) 编辑
摘要: int maxDepth(char * s){ int cnt=0,max=0; for(int i=0; s[i]!='\0'; i++){ if(s[i]=='('){ cnt++; if(cnt>max) max=cnt; } else if(s[i]==')') cnt--; } retur 阅读全文
posted @ 2020-11-09 13:16 温暖了寂寞 阅读(413) 评论(0) 推荐(0) 编辑
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 63 下一页