class Solution:
def isAnagram(self, s: str, t: str) -> bool:
return Counter(s) == Counter(t)
本题数组无序,需要输出下标。有序情况使用双指针。剑指 Offer II 006. 排序数组中两个数字之和
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
# 遍历列表同时查字典
map = dict()
for i, n in enumerate(nums):
m = target - n
if