上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 63 下一页
摘要: bool isUgly(int num){ if (num == 0) { return false; } int arr[] = {2,3,5}; int i = 0; for(i=0; i<3; i++) { if (num % arr[i] == 0) { num /= arr[i]; i = 阅读全文
posted @ 2020-08-29 17:35 温暖了寂寞 阅读(146) 评论(0) 推荐(0) 编辑
摘要: char ** uncommonFromSentences(char * A, char * B, int* returnSize){ int alen = strlen(A); int blen = strlen(B); if (!alen && !blen) { * returnSize = 0 阅读全文
posted @ 2020-08-29 13:53 温暖了寂寞 阅读(189) 评论(0) 推荐(0) 编辑
摘要: int numUniqueEmails(char ** emails, int emailsSize){ char* arr[100] = { 0 }; int index = 0; bool flag = true; for (int i = 0; i < emailsSize; i++) { c 阅读全文
posted @ 2020-08-29 10:03 温暖了寂寞 阅读(162) 评论(0) 推荐(0) 编辑
摘要: int uniqueMorseRepresentations(char ** words, int wordsSize){ char* morse[26] = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ". ", 阅读全文
posted @ 2020-08-28 20:49 温暖了寂寞 阅读(163) 评论(0) 推荐(0) 编辑
摘要: bool uniqueOccurrences(int* arr, int arrSize){ int phash[1001] = {0}; // 存放正数次数 int nhash[1001] = {0}; // 存放负数次数 int hash[1001] = {0}; // 存放次数的次数 for 阅读全文
posted @ 2020-08-28 11:14 温暖了寂寞 阅读(164) 评论(0) 推荐(0) 编辑
摘要: bool func(struct TreeNode* node,int val) { if (!node) return true; if (node->val != val) return false; return func(node->left,val) && func(node->right 阅读全文
posted @ 2020-08-28 10:36 温暖了寂寞 阅读(63) 评论(0) 推荐(0) 编辑
摘要: bool isAnagram(char * s, char * t){ int n=strlen(s),m=strlen(t); if(n!=m)return false; if (!*s && !*t) return true; if (strlen(s) == 1 && strlen(t) == 阅读全文
posted @ 2020-08-28 10:15 温暖了寂寞 阅读(183) 评论(0) 推荐(0) 编辑
摘要: bool validMountainArray(int* A, int ASize){ if (ASize<3)return false; int index = ASize; for (int i = 0; i < ASize-1; i++) { if (i == 0 && A[i]>=A[i + 阅读全文
posted @ 2020-08-27 23:18 温暖了寂寞 阅读(176) 评论(0) 推荐(0) 编辑
摘要: bool isPalindrome(char *str) { int i, n; if (str == NULL) { return 0; } else if (strlen(str) == 0) { return 1; } n = strlen(str) - 1; for (i = 0; i <= 阅读全文
posted @ 2020-08-27 13:01 温暖了寂寞 阅读(131) 评论(0) 推荐(0) 编辑
摘要: bool validPalindrome(char * s){ for (int i = 0, j = strlen(s)-1; i < j; ++i, --j) if (s[i] != s[j]) return (judge(s, i+1,j) || judge(s, i,j-1)); retur 阅读全文
posted @ 2020-08-26 23:29 温暖了寂寞 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 63 下一页