Skip to content

Practice All Divisions With the Highest Score of a Binary Array

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

Medium#2155
LeetCode Problem

All Divisions With the Highest Score of a Binary Array

Problem Statement

For each split i from 0 through nums.length, put indices below i on the left and indices from i onward on the right. Its score is the number of zeros on the left plus ones on the right. Either part may be empty. Return all maximizing split indices in any order.

Source: All Divisions With the Highest Score of a Binary Array on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [0,0,1,0]
Output
[2,4]

# Example 2

Input
nums = [0,0,0]
Output
[3]

# Example 3

Input
nums = [1,1]
Output
[0]

Constraints

n == nums.length
1 <= n <= 10^5
nums[i] is either 0 or 1.

Related LeetCode Problems

Practice more problems similar to All Divisions With the Highest Score of a Binary Array.

Review your practice with PhantomCodeAI

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