难度:easy

Given an array of integers, every element appears twice except for one. Find that single one.

Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

思路:1. 这种找出list里面唯一一个重复次数与其他都不同的element的题特别适合用dictionary来做。

           2. 将list里面的每个element变成dictionary里的key,element在list里面出现的次数则为value,最后找到value=1时对应的key即可。

           3. dictionary操作:

leetcode 136-Single Number

          leetcode 136-Single Number

相关文章:

  • 2021-07-28
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
猜你喜欢
  • 2021-10-25
  • 2021-06-10
  • 2021-06-11
  • 2021-06-27
  • 2022-01-20
  • 2021-06-19
  • 2021-11-25
相关资源
相似解决方案