Skip to content

Practice Can Make Arithmetic Progression From Sequence

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1502
LeetCode Problem

Can Make Arithmetic Progression From Sequence

Problem Statement

A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same. Given an array of numbers arr, return true if the array can be rearranged to form an arithmetic progression. Otherwise, return false.

Source: Can Make Arithmetic Progression From Sequence on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
arr = [3,5,1]
Output
true

# Example 2

Input
arr = [1,2,4]
Output
false

Constraints

2 <= arr.length <= 1000
-10^6 <= arr[i] <= 10^6

Related LeetCode Problems

Practice more problems similar to Can Make Arithmetic Progression From Sequence.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.