摘要:
DFA法 思路: 确定的有穷自动机,相关参考8. 字符串转换整数 (atoi) 遍历字符串,遇到的字符总共有6种。(空格,正负号,数字,小数点,字符e,无效字符) 可能出现的状态有11种: start:初始状态 signed:符号态 integer:整数态 sDot:特殊的初始小数点态(小数点之前为 阅读全文
posted @ 2020-06-07 16:20
nil_f
阅读(176)
评论(0)
推荐(0)
摘要:
动态规划 思路: dp[i][j]表示走完 i,j 位置所需的最短路径,由于只能向下或者向右,所以第一行和第一列中每个值为当前值加上前一个值,即dp[0][j]=dp[0] [j]+dp[0][j-1],dp[i][0] = dp[i][0]+dp[i-1][0]。非第一行和第一列的值为当前值加上其 阅读全文
posted @ 2020-06-07 13:53
nil_f
阅读(110)
评论(0)
推荐(0)
摘要:
动态规划 思路: 参考62. 不同路径 代码: class Solution: def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int: m = len(obstacleGrid) n = len(obstac 阅读全文
posted @ 2020-06-07 13:35
nil_f
阅读(123)
评论(0)
推荐(0)