llllmz

导航

2024年3月22日

2605. 从两个数字数组里生成最小数字c

摘要: int minNumber(int* nums1, int nums1Size, int* nums2, int nums2Size) { int min=INT_MAX; for(int i=0;i<nums1Size;i++){ int sum=0; for(int j=0;j<nums2Siz 阅读全文

posted @ 2024-03-22 11:08 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

2367. 算术三元组的数目c

摘要: int count; void dfs(int* nums,int numsSize,int diff,int index,int pre,int nowcount){ if(index>numsSize || nowcount>3) return; if(index==numsSize && no 阅读全文

posted @ 2024-03-22 10:53 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

2652. 倍数求和c

摘要: int sumOfMultiples(int n){ int* dp=(int*)malloc(sizeof(int)*(n+4)); dp[1]=0,dp[2]=0; for(int i=3;i<=n;i++){ if(i%3==0 || i%5==0 || i%7==0 ){ dp[i]=dp[ 阅读全文

posted @ 2024-03-22 10:30 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0) 编辑

2798. 满足目标工作时长的员工数目c

摘要: int numberOfEmployeesWhoMetTarget(int* hours, int hoursSize, int target){ int count=0; for(int i=0;i<hoursSize;i++){ if(hours[i] >= target) count++; } 阅读全文

posted @ 2024-03-22 10:24 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

2917. 找出数组中的 K-or 值c

摘要: int findKOr(int* nums, int numsSize, int k) { if(k>numsSize) return 0; int sum=0; for(int i=0;i<31;i++){ int count=0; for(int j=0;j<numsSize;j++){ int 阅读全文

posted @ 2024-03-22 10:23 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

2465. 不同的平均值数目c

摘要: int cmp(const void* a,const void* b){ return *(int*)a-*(int*)b; } int distinctAverages(int* nums, int numsSize) { if(numsSize <=2) return 1; qsort(num 阅读全文

posted @ 2024-03-22 10:08 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

2024年3月21日

90. 子集 IIc

摘要: /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array a 阅读全文

posted @ 2024-03-21 20:56 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

125. 验证回文串c

摘要: bool judge(char c){ if(c>='a'&& c<='z' || c>='A' && c<='Z' || c>='0' && c<='9' ) return true; return false; } bool isPalindrome(char* s) { int n=strle 阅读全文

posted @ 2024-03-21 20:38 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

234. 回文链表c

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

posted @ 2024-03-21 20:27 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0) 编辑

66. 加一c

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

posted @ 2024-03-21 20:24 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0) 编辑