bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
EasyArrays & HashingLC 1228

Missing Number In Arithmetic Progression

In some array arr, the values were in arithmetic progression: the values arr[i + 1] - arr[i] are all equal for every 0 <= i < arr.length - 1. A value from arr was removed that was not the first or last value in the array. Given arr, return the removed value.

Asked at 1 company
Audible
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