题目:

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.

Find all the elements that appear twice in this array.

Could you do it without extra space and in O(n) runtime?

Example:

Input:
[4,3,2,7,8,2,3,1]

Output:
[2,3]

思路:

leetcode Add to List 442. Find All Duplicates in an Array

相关文章:

  • 2021-09-21
  • 2021-12-01
  • 2021-11-30
  • 2021-06-12
  • 2021-06-22
  • 2021-07-28
  • 2021-10-31
猜你喜欢
  • 2021-11-29
  • 2021-09-16
  • 2021-07-02
  • 2021-09-08
  • 2021-11-23
  • 2021-10-10
相关资源
相似解决方案