#3192

Minimum Operations to Make Binary Array Elements Equal to One II

specialist · 645 · lc medium +30 · 65% accepted · 152 likes · top 69%

Description

You are given a binary array nums.

You may apply any number of operations (possibly zero):

- Choose any index i and flip every element from position i through the end of the array.

Return the minimum number of operations to turn every element of nums into 1.

Code

1
2
3