上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 44 下一页
摘要: 问题: 给定一组非负整数nums,和一个目标数S,求给nums的各个元素添加符号后,使得和为S的可能性有多少? Example 1: Input: nums is [1, 1, 1, 1, 1], S is 3. Output: 5 Explanation: -1+1+1+1+1 = 3 +1-1+ 阅读全文
posted @ 2020-08-29 17:45 habibah_chang 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组只包含'0' '1' 的字符串,给定两个正整数m和n,问,要使用m个'0' n个'1',能最多构成多少个给出字符串组中的字符串。 Example 1: Input: strs = ["10","0001","111001","1","0"], m = 5, n = 3 Output: 阅读全文
posted @ 2020-08-29 16:43 habibah_chang 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组数,请问是否将其分为两个数组,使得二者和相等。 Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input: [1, 5, 11, 阅读全文
posted @ 2020-08-29 12:06 habibah_chang 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 问题: 求给定数组中,最长递增子序列的长度。 Example: Input: [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest increasing subsequence is [2,3,7,101], therefore the l 阅读全文
posted @ 2020-08-28 15:32 habibah_chang 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组硬币面值coins,和一个总价amount 求最少用多少个硬币能构成总价,若无法构成,返回-1 Example 1: Input: coins = [1, 2, 5], amount = 11 Output: 3 Explanation: 11 = 5 + 5 + 1 Example 阅读全文
posted @ 2020-08-26 19:33 habibah_chang 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定K个鸡蛋,测试N层楼。 若鸡蛋在某一层落下后,刚好不摔碎(再上一层则摔碎),那么即检测到该层F为目标层。 问要检测到F层,最少测试次数为多少? 假设提供到F层被检测对象,为最坏结果(在某一层测试后,鸡蛋的碎或不碎状态,由使得测试对象要被测最多次来决定) Example 1: Input: 阅读全文
posted @ 2020-08-24 17:17 habibah_chang 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 转自 https://zxi.mytechroad.com/blog/sp/amortized-analysis/ 证明:1+2+4+8+...+n = 2n-1 a1=1,项数k=log2(n)+1 =等比数列求和=a1*(q^n-1)/(q-1) ①:Sn=a1+a2+...+an ②:q*Sn 阅读全文
posted @ 2020-08-18 14:53 habibah_chang 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 问题: 在以下构成的Multiplication Table中,找到第K个小的数字。 The Multiplication Table: m=3, n=3 1 2 3 2 4 6 3 6 9 The Multiplication Table: m=4,n=51 2 3 4 52 4 6 8 103 阅读全文
posted @ 2020-08-16 15:56 habibah_chang 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定a,b,c 求出第n个能被a或b或c整除的正整数。(这种数也被称为:Ugly Number) Example 1: Input: n = 3, a = 2, b = 3, c = 5 Output: 4 Explanation: The ugly numbers are 2, 3, 4, 阅读全文
posted @ 2020-08-16 14:44 habibah_chang 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个花圃,每个元素表示该位置的花,开花所需要的天数。 要求用连续k个位置上的花组成一个花束,共组成m个花束,所需要的最短天数。 Example 1: Input: bloomDay = [1,10,3,10,2], m = 3, k = 1 Output: 3 Explanation: 阅读全文
posted @ 2020-08-16 14:07 habibah_chang 阅读(439) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 44 下一页