uacs2024

导航

2024年12月28日 #

leetcode 2466. 统计构造好字符串的方案数

摘要: 2466. 统计构造好字符串的方案数 没写出来🤡 题解 法一:记忆化搜索 class Solution { public: // 计算在[low, high]范围内,满足'0'的数量不超过zero,'1'的数量不超过one的字符串数量 int countGoodStrings(int low, i 阅读全文

posted @ 2024-12-28 20:46 ᶜʸᵃⁿ 阅读(51) 评论(0) 推荐(0)

leetcode 377. 组合总和 Ⅳ

摘要: 377. 组合总和 Ⅳ 没写出来🤡 官方题解 class Solution { public: //当1 ≤ i ≤ target 时,如果存在一种排列,其中的元素之和等于 i,则该排列的最后一个元素一定是数组 nums 中的一个元素。 //假设该排列的最后一个元素是 num,则一定有 num ≤ 阅读全文

posted @ 2024-12-28 17:56 ᶜʸᵃⁿ 阅读(35) 评论(0) 推荐(0)

leetcode 746. 使用最小花费爬楼梯

摘要: 746. 使用最小花费爬楼梯 class Solution { public: int minCostClimbingStairs(vector<int>& cost) { int n = cost.size(); vector<int> dp(n+1);//dp[i]代表到达第 i 层的最小花费 阅读全文

posted @ 2024-12-28 15:53 ᶜʸᵃⁿ 阅读(16) 评论(0) 推荐(0)

leetcode 475. 供暖器

摘要: 475. 供暖器 没做出来🤡 法一:排序 + 二分查找 class Solution { public: //lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的。 //在从小到大的排序数组中,lower_bound(begin,end,n 阅读全文

posted @ 2024-12-28 15:10 ᶜʸᵃⁿ 阅读(22) 评论(0) 推荐(0)