Skip to content

Practice Split Array With Same Average

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

Hard#805
LeetCode Problem

Split Array With Same Average

Problem Statement

You are given an integer array nums. You should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and average(A) == average(B). Return true if it is possible to achieve that and false otherwise. Note that for an array arr, average(arr) is the sum of all the elements of arr over the length of arr.

Source: Split Array With Same Average on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,2,3,4,5,6,7,8]
Output
true

# Example 2

Input
nums = [3,1]
Output
false

Constraints

1 <= nums.length <= 30
0 <= nums[i] <= 10^4

Related LeetCode Problems

Practice more problems similar to Split Array With Same Average.

Review your practice with PhantomCodeAI

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