上一页 1 2 3 4 5 6 7 8 9 ··· 44 下一页
摘要: 类似解法问题(index符号标记法) 442. Find All Duplicates in an Array 448. Find All Numbers Disappeared in an Array 问题: 给定size=n的数组,记录1~n。 其中存在某个数字重复,占用另一个数字的空间,导致漏 阅读全文
posted @ 2021-04-05 10:50 habibah_chang 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 问题: 勇士救公主问题。 勇士从左上角[0,0]出发,要到达右下角[n-1,m-1]公主所在。 只能向右or向下移动。 格子上的数字代表:加减血。 若到达某个格子勇士血量<1那么,勇士立即死亡。游戏失败。 求,至少在出发时,勇士的初始血量是多少。 Example 1: Input: dungeon 阅读全文
posted @ 2021-04-01 18:08 habibah_chang 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 问题: 求第n个ugly number 定义:ugly number:只由2or3or5作为因数求得。 1为第一个ugly number。 Example 1: Input: n = 10 Output: 12 Explanation: [1, 2, 3, 4, 5, 6, 8, 9, 10, 12 阅读全文
posted @ 2021-04-01 14:00 habibah_chang 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定字符串s,匹配串t 求s中匹配t的方法有多少种。 匹配:s中存在t的序列。 Example 1: Input: s = "rabbbit", t = "rabbit" Output: 3 Explanation: As shown below, there are 3 ways you 阅读全文
posted @ 2021-04-01 13:34 habibah_chang 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 问题: 求a^b%base的值。 a为int型数 b为int数组,例如[1,2,3,4]代表:b=1234 base=1337。 Example 1: Input: a = 2, b = [3] Output: 8 Example 2: Input: a = 2, b = [1,0] Output: 阅读全文
posted @ 2021-04-01 10:16 habibah_chang 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定有0和1构成的二维数组, 求数组中,连续 1 构成正方形的面积最大是多少。 Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1&quo 阅读全文
posted @ 2021-03-31 15:20 habibah_chang 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定字符串s,和词典wordDict 若s可拆分成多个子串,存在于词典中,则返回true。否则返回false。 Example 1: Input: s = "leetcode", wordDict = ["leet","code"] Output: true Explanation: Ret 阅读全文
posted @ 2021-03-31 14:33 habibah_chang 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个数组,求任意区间[left, right]的元素和。 Example 1: Input ["NumArray", "sumRange", "sumRange", "sumRange"] [[[-2, 0, 3, -5, 2, -1]], [0, 2], [2, 5], [0, 5]] 阅读全文
posted @ 2021-03-31 14:00 habibah_chang 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定3个字符串, 由s1和s2构成s3。 若可以做到,返回true,否则返回false。 Example 1: Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac" Output: true Example 2: Input: s1 = " 阅读全文
posted @ 2021-03-25 15:05 habibah_chang 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 问题: 求从0 到 小于给定n 的正整数中,有多少个素数(质数)。 素数:只能被 自己 和 1 整除。(1和0不是) Example 1: Input: n = 10 Output: 4 Explanation: There are 4 prime numbers less than 10, the 阅读全文
posted @ 2021-03-25 13:37 habibah_chang 阅读(26) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 44 下一页