思路1 hash

  • 时间复杂度 O(2n)

  • 空间复杂度 O(n)

遍历两遍,第一遍计数,第二遍判断

Last updated