摘要: 242.有效的字母异位词 1、数组法 这个思路贼 6 ,在这个题的效率也高 class Solution: def isAnagram(self, s: str, t: str) -> bool: # 全部转为 asii 码 如果是互为异为词,则最后的 -+ 后的结果为 0 record = [0] 阅读全文
posted @ 2023-10-16 23:45 忆象峰飞 阅读(26) 评论(0) 推荐(0)
摘要: 一、203.移除链表元素 关键点:如何删除节点,需要知道删除节点前的节点。 1、无虚拟头节点的方法 class Solution: def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: 阅读全文
posted @ 2023-10-16 21:57 忆象峰飞 阅读(25) 评论(0) 推荐(0)