摘要: 问题: 勇士救公主问题。 勇士从左上角[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) 编辑