bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
MediumArrays & HashingLC 954

Array of Doubled Pairs

Given an integer array of even length arr, return true if it is possible to reorder arr such that arr[2 i + 1] = 2 arr[2 i] for every 0 <= i < len(arr) / 2, or false otherwise.

Asked at 2 companies
GoogleUber
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