Skip to content

rvndios/MaximumSeparation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

MaximumSeparation

Description

Problem:

'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.

Inputs

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]

Outputs

99
4
2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published