VISA | onsite

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-10-01Added By Anonymous
Source: Link

Problem to accommodate N people in M rooms with k constraints such that two people can’t be in the same room.


Return true if can be accomodated in M rooms given the constraints.

N=3

M=2


k={1,2},{3,2} 1 & 2 cannot be in same room , 3 & 2 cannot be in same room

Ans : true (only 2 rooms are required) = In one room person 1 and 2 can be accomodated and in another person 3.


I was asked to solve this question in 12 minutes.


Any similar leetcode question?

Comments