Leetcode 9-12

No. 9 Palindrome Number (简单,PASS)

Leetcode 9-12


No. 10 Regular Expression Matching (HARD)

https://leetcode.com/problems/regular-expression-matching/discuss/5723/My-DP-approach-in-Python-with-comments-and-unittest


No. 11 Container With Most Water

Leetcode 9-12

注意点:本题目并不是求已给出的height中符合要求的sum最大,而是给出最大能盛水的量。

Solution: Two Pointers

Note: The most water = width * min(left, right), where width = j - i, i and j are the indexes of two sides.


No. 12 Integer to Roman

将整数转换成罗马数字(Roman),字符表对应如下:

Leetcode 9-12

其中,有六种特殊情况,如下:

Leetcode 9-12

Solution:不断整除,分母分别为[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]。

上一篇:lc13 Roman to Integer


下一篇:13 Roman to Integer