LeetCode日积月累
刷题笔记
清欢年岁~
计算机视觉、深度学习
展开
-
LeetCode习题笔记(387,383,242)
387class Solution: def firstUniqChar(self, s: str) -> int: for i in range(len(s)): for j in range(len(s)): if i!=j and s[j] == s[i]: break else: return i原创 2022-05-22 15:39:57 · 97 阅读 · 0 评论 -
LeetCode习题笔记(36,73)
36class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: # 1. 判断行中有无相同的数 row, col = len(board), len(board[0]) for i in range(row): num_set = set() for j in range(col):原创 2022-05-20 20:26:31 · 80 阅读 · 1 评论 -
LeetCode习题笔记(566、118)
566class Solution: def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]: new_mat = [] for i in range(len(mat)): for j in range(len(mat[i])): new_mat.append(mat[i][j])原创 2022-05-15 23:07:19 · 78 阅读 · 0 评论 -
LeetCode习题笔记(121 350 88 217 53)
121题:买卖股票class Solution: def maxProfit(self, prices: List[int]) -> int: n = len(prices) dp = [0]*len(prices) minprice = prices[0] for i in range(1,n): minprice = min(prices[i],minprice) dp [i]原创 2022-05-14 22:40:06 · 75 阅读 · 0 评论