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 to N 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 Kth guest wants to be in a room that contains at most AK 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
