solulubeta
Sign in
Story Problems / Arrays, windows & two pointers
01.11 · Problem

Group the Occupied Seats

Medium Fixed window (window size = number of ones) Pro

This problem is part of solulu Pro

In a cinema row, seats are marked 1 (occupied) or 0 (empty). To take a group photo, all occupied people should sit together. In one move, any two seats can swap their occupants. What is the minimum number of swaps?

Lifetime ₹2,000 ₹1,000 · Beta offer
Mark this problem as solved when you are finished.

Item 11 of 94 · updated 2026-10-12