Tap here to switch tabs
Problem
Submissions

Problem: Can Make Arithmetic Progression From Sequence

Can Make Arithmetic Progression From Sequence asks whether an array can be rearranged so every pair of consecutive values has the same difference, returning true or false.

Statement

A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is constant.

Given an array of numbers arr, return true if the array can be rearranged to form an arithmetic progression, and false otherwise.

Constraints:

  • 2≤2 \leq arr.length ≤1000\leq 1000

  • −106≤-10^6 \leq arr[i] ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Can Make Arithmetic Progression From Sequence

Can Make Arithmetic Progression From Sequence asks whether an array can be rearranged so every pair of consecutive values has the same difference, returning true or false.

Statement

A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is constant.

Given an array of numbers arr, return true if the array can be rearranged to form an arithmetic progression, and false otherwise.

Constraints:

  • 2≤2 \leq arr.length ≤1000\leq 1000

  • −106≤-10^6 \leq arr[i] ≤106\leq 10^6