Search
⌘K

Leetcode 2155. All Divisions With the Highest Score of a Binary Array

Given a binary array, consider every split index i (0..n) and compute its score as zeros in the left part plus ones in the right part; return all indices with the maximum score. This is typically solved by tracking prefix zeros and remaining ones (or using prefix sums) to compute all scores in one pass.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.