Ayush7614 / Daily-Coding-DS-ALGO-Practice

A open source project🚀 for bringing all interview💥💥 and competative📘 programming💥💥 question under one repo📐📐
https://daily-ds-algo.github.io/DS-Algo-Website/
MIT License
321 stars 474 forks source link

minimum-swaps-to-group-all-1s-together #1453

Open thejaswin123 opened 3 years ago

thejaswin123 commented 3 years ago

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

priyanshi5 commented 3 years ago

I would like to solve this problem in C++. Please assign me this issue under LGM-SOC'21.