Pattern: 3 DSA + 18 -20 MCQS
You are given a binary array arr of size N, consisting only of 0s and 1s.
In one operation, you may flip any single element, i.e.:
0 → 11 → 0Find the minimum number of flips required so that the number of 0s and 1s in the array becomes equal.
If it is impossible, print -1.
0 or 1).Print a single integer representing the minimum number of flips required.
6
1 1 1 0 0 0
0
8
1 1 1 1 0 0 0 0
0
Expert in Data Structures & Algorithms. Building tools to help developers crack FAANG interviews.
6
1 1 1 1 1 0
2
5
1 1 0 0 1
-1
Jefeeerirs • Pending
Jefeeerirs • Pending
Texas • Pending
Texas • Pending
Barclays • Pending