Can Make Arithmetic Progression From Sequence
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A sequence is an **arithmetic progression** when the difference between every pair of consecutive elements is the same.
Given an integer array arr, return true if its elements can be reordered to form an arithmetic progression, and false otherwise. Aim for O(n) time if you can (sorting in O(n log n) is also accepted).
Examples
Constraints
- 2 <= arr.length <= 1000
- -10^6 <= arr[i] <= 10^6
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.