摘要:
** 344.反转字符串** class Solution: def reverseString(self, s: List[str]) -> None: left = 0 right = len(s)-1 while left < right: temp = s[left] s[left] = s 阅读全文
摘要:
242.有效的字母异位词 思路:26位的array,每个分别对应a, b, c..., z,如果遇到一个字母就++,如果两个array一样则为anagram hint: to initiate an array with n elements carrying value 0: arr=[] arr 阅读全文
摘要:
203.移除链表元素 竟然可以做个假head,学到了 class ListNode(object): def __init__(self, val=0, next=None): self.val = val self.next = next class Solution(object): def r 阅读全文
摘要:
Model optimizations to improve application performance Distillation: uses a larger model, the teacher model, to train a smaller model, the student mod 阅读全文
摘要:
977.有序数组的平方 暴力解法,熟悉python的array.sort()用法 可以再温习一下不同sort的算法写法以及complexity class Solution(object): def sortedSquares(self, nums): for i in range(len(nums 阅读全文