Question: There are N guests ( numbered from 0 to N - 1 ) in a sanatorium waiting to be assigned a room. In each room,

There are N guests (numbered from 0 to N-1) in a sanatorium waiting to be assigned a room. In each room, any number of guests can be accommodated. However, not all guests like to have a lot of roommates.
You are given an array A of N integers: the K-th guest wants to be in a room that contains at most A[K] guests, including themselves.
Write a function that, given the array A, returns the minimum number of rooms needed to accommodate all guests.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Problem Overview We are given An array A of length N where each element Ak represents the maximum nu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!