bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
EasyArrays & HashingLC 961

N-Repeated Element in Size 2N Array

You are given an integer array nums with the following properties: nums.length == 2 n. nums contains n + 1 unique elements. Exactly one element of nums is repeated n times. Return the element that is repeated n times.

Asked at 2 companies
AkamaiApple
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode