上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 44 下一页
摘要: 问题: 给定n个节点,以及节点直接的连线数组edges 已知,这些节点代表城市,这些城市构成一棵树, 即任意两节点都有唯一路径。 求,这些城市中的子树中,各个最大路径的子树个数。 Example 1: Input: n = 4, edges = [[1,2],[2,3],[2,4]] Output: 阅读全文
posted @ 2021-02-13 13:30 habibah_chang 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 问题: 将给定的字符串s,最多能够分割成多少个互不重复的字符串? Example 1: Input: s = "ababccc" Output: 5 Explanation: One way to split maximally is ['a', 'b', 'ab', 'c', 'cc']. Spl 阅读全文
posted @ 2021-02-12 09:33 habibah_chang 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 参考:花花酱的解 问题: 给定c_n个颜色的多个球。balls[i]表示:第i个颜色的球数。 将这些球平均分装两个盒子。每个盒子球数相同。 求最终两个盒子中球色种类数相同的装法概率。 Example 1: Input: balls = [1,1] Output: 1.00000 Explanatio 阅读全文
posted @ 2021-02-11 14:01 habibah_chang 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 问题: 求由n个字符构成,按照字母序排序后,第k个happy string。 happy string定义: consists only of letters of the set ['a', 'b', 'c']. 仅由a,b,c构成 s[i] != s[i + 1] for all values 阅读全文
posted @ 2021-02-10 09:34 habibah_chang 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组字符串,和一个结果字符串,使用0~9对字母进行编码。 使得字符串数组相加后,结果=结果字符串。 求是否可能存在这样的编码。 Each character is decoded as one digit (0 - 9). Every pair of different characte 阅读全文
posted @ 2021-02-07 12:37 habibah_chang 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定长宽m,n的矩形,将其划分为多个正方形,最少能划分多少个。 Example 1: Input: n = 2, m = 3 Output: 3 Explanation: 3 squares are necessary to cover the rectangle. 2 (squares o 阅读全文
posted @ 2021-02-07 08:24 habibah_chang 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组字符串数组, 有这些字符串合并构成不存在重复字符的“集连字符串” 求该集连字符串最大长度。 Example 1: Input: arr = ["un","iq","ue"] Output: 4 Explanation: All possible concatenations are 阅读全文
posted @ 2021-02-06 09:03 habibah_chang 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个二维数组表示藏金矿地图,每个cell表示所在位置藏有的金矿量, 求从任意一个cell开始走地图,不走走过的cell,不走金矿量=0的cell,只能从当前cell的上下左右四个方向进行下一步移动。 最终能获得的最大金矿量。 Example 1: Input: grid = [[0,6, 阅读全文
posted @ 2021-02-06 07:07 habibah_chang 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个范围[low, high], 求所有在这个范围的数(从小到大排序后的),要求:这些数的后一位数字比前一位数字大一。 Example 1: Input: low = 100, high = 300 Output: [123,234] Example 2: Input: low = 10 阅读全文
posted @ 2021-02-01 15:53 habibah_chang 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 问题: 设计一个组合指针类,通过给定组合元素characters,要求构成组合的大小combinationLength,实现以下方法 构造方法:CombinationIterator(string characters, int combinationLength) 返回下一个组合:next() 是 阅读全文
posted @ 2021-01-30 18:03 habibah_chang 阅读(75) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 44 下一页