If n beds are to be allocated to m people.Each may have multiple preferences or not prefer at all. How to satisfy maximum people. A person who had a preference and got the same will be accounted as a satisfied person.
I tried allocating a person with minimum preferences first with minimum preferred bed. Is there some case I am missing, because it gave me a wrong answer?