You are given an array rooms, where each element represents the number of available seats in a consecutive block of seats (i.e., a “room”).
All rooms are arranged back-to-back, forming one continuous sequence of seats.
You must distribute k people among these seats such that the minimum distance between any two people (measured in number of seats between them) is as large as possible.
Return this maximum possible minimum distance.
Input:
rooms = [3, 1, 4, 2]
k = 4
Total seats = 3 + 1 + 4 + 2 = 10
Seat indices: 0 1 2 | 3 | 4 5 6 7 | 8 9
Optimal placement: [0, 3, 6, 9]
Minimum distance = 3
Output: 3