摘要:
因为两者操作差不多,所以get和update都要O(n) class NumMatrix: def __init__(self, matrix: List[List[int]]): if matrix is None or len(matrix) == 0 or len(matrix[0]) == 阅读全文
摘要:
调用多次readN,所以要重复使用internal buffer """ The read4 API is already defined for you. @param buf, a list of characters @return an integer def read4(buf): # B 阅读全文
摘要:
O(n^2)的方法,最后一个case超时。需要用kmp方法或者manacher方法才能O(n),先忽略了。 class Solution: def isPalindrome(self, sub: str) -> bool: for i in range(len(sub) // 2): if sub[ 阅读全文