'M' viewers want to sit in a theatre. The theatre has 'N' empty seats. The position of these seats is position if with the distance being measured from the entrance. All the position[i] are distinct. These M people want to sit as far away from each other as possible. The distance between two people is measured as position[i] - position[j]. Allot seats to these M people such that the minimum distance among all pairs of people is maximized. The output is the minimum maximized distance.
let viewers = 2
let noOfSeatsAvailable = 6 // Max 10
let seatNo = [1,2,3,4,5, 100]
let viewers = 3
let noOfSeatsAvailable = 6 // Max 10
let seatNo = [1,2,3,4,5, 100]
let viewers = 4
let noOfSeatsAvailable = 6 // Max 10
let seatNo = [1,2,3,4,5, 100]
99
4
2