1 COUNT using DP

how to solve 1 count problem using DP?
Problem link- https://hack.codingblocks.com/practice/p/346/916
Any hint is highly appreciated :slight_smile:

For all positions of 0’s calculate left[] and right[] which defines the number of consecutive 1’s to the left of i and right of i respectively. Now compute the maximum numbers of ones that can be formed by flipping that zero…for every zero, using the left and right arrays