← ALL NOTES
Array

3191. Minimum Operations to Make Binary Array Elements Equal to One I

Given a binary array nums. One operation picks any 3 consecutive elements and flips them (0↔1). Find the minimum operations to make all elements equal to 1, or −1 if impossible. Greedy left to right:…

Loading…