Open thejaswin123 opened 3 years ago
Given an array of 0’s and 1’s, we need to write a program to find the minimum number of swaps required to group all 1’s present in the array together.
arr[] = {1, 0, 1, 0, 1, 1}
1
I would like to solve this problem in C++. Please assign me this issue under LGM-SOC'21.
Aim
Given an array of 0’s and 1’s, we need to write a program to find the minimum number of swaps required to group all 1’s present in the array together.
Input
arr[] = {1, 0, 1, 0, 1, 1}
Output
1
Programming language