llllmz

导航

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 35 下一页

2024年3月15日

66. 加一c

摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ void reverse(int* a,int n){ int head=0,tail=n-1; while(head<=tail){ in 阅读全文

posted @ 2024-03-15 21:23 神奇的萝卜丝 阅读(3) 评论(0) 推荐(0)

83. 删除排序链表中的重复元素c

摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ int pre; struct ListNode* f(struct ListNode* 阅读全文

posted @ 2024-03-15 21:01 神奇的萝卜丝 阅读(6) 评论(0) 推荐(0)

67. 二进制求和c

摘要: 特好的题目,进制转化就刷它。 void reverse(char* s){ int n=strlen(s); int head=0,tail=n-1; while(head<=tail){ char t=s[head]; s[head]=s[tail]; s[tail]=t; head++; tai 阅读全文

posted @ 2024-03-15 20:37 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0)

169. 多数元素c

摘要: int cmp(const void* a,const void* b){ return *(int*)a-*(int*)b; } int majorityElement(int* nums, int numsSize) { qsort(nums,numsSize,sizeof(int),cmp); 阅读全文

posted @ 2024-03-15 19:49 神奇的萝卜丝 阅读(5) 评论(0) 推荐(0)

9. 回文数c

摘要: bool isPalindrome(int x) { char c[1000]={0}; sprintf(c,"%d",x); int n=strlen(c); int head=0,tail=n-1; while(head<=tail){ if(c[head]!=c[tail]) return f 阅读全文

posted @ 2024-03-15 19:44 神奇的萝卜丝 阅读(6) 评论(0) 推荐(0)

21. 合并两个有序链表c

摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode* mergeTwoLists(struct ListNod 阅读全文

posted @ 2024-03-15 19:35 神奇的萝卜丝 阅读(7) 评论(0) 推荐(0)

14. 最长公共前缀c

摘要: char* longestCommonPrefix(char** strs, int strsSize) { int index=1,min=INT_MAX; if(strsSize==1) return strs[0]; while(index<strsSize){ int i=0; while( 阅读全文

posted @ 2024-03-15 18:30 神奇的萝卜丝 阅读(9) 评论(0) 推荐(0)

13. 罗马数字转整数c

摘要: int romanToInt(char* s) { int n=strlen(s); int c[26]; c['I'-'A']=1; c['V'-'A']=5; c['X'-'A']=10; c['L'-'A']=50; c['C'-'A']=100; c['D'-'A']=500; c['M'- 阅读全文

posted @ 2024-03-15 18:20 神奇的萝卜丝 阅读(6) 评论(0) 推荐(0)

121. 买卖股票的最佳时机c

摘要: int max(int i,int j){ if(i>j) return i; return j; } int maxProfit(int* prices, int pricesSize) { int** dp=(int**)malloc(sizeof(int*)*pricesSize); for( 阅读全文

posted @ 2024-03-15 17:57 神奇的萝卜丝 阅读(4) 评论(0) 推荐(0)

1768. 交替合并字符串c

摘要: char * mergeAlternately(char * word1, char * word2){ int n1=strlen(word1),n2=strlen(word2); char* temp=(char*)malloc(sizeof(char)*(n1+n2+1)); int inde 阅读全文

posted @ 2024-03-15 16:52 神奇的萝卜丝 阅读(20) 评论(0) 推荐(0)

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 35 下一页