An Interview Problem

Revision en4, by Misa-Misa, 2023-12-17 15:33:41

Past week, i was asked this problem in an interview, i don't know the solution till now, help me with this.

Problem

There are $$$N$$$ people in a group, weight of $$$i$$$ 'th person is $$$W[i]$$$, there is a lift of capacity $$$C$$$ which is the maximum weight the lift can carry, everyone wants to go to the top floor via lift.
Determine $$$M$$$, where $$$M$$$ is the minimum times lift must be used by the group so that everyone is able to go to the top floor.

Constraints

Not sure about constraints, please give the best solution you can.

Test Case

$$$N$$$ = 4
$$$C$$$ = 90
$$$W$$$ = [10, 20, 70, 80]

$$$ANS$$$ = 2

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Misa-Misa 2023-12-17 15:33:41 0 (published)
en3 English Misa-Misa 2023-12-17 15:33:10 15
en2 English Misa-Misa 2023-12-17 15:32:45 87
en1 English Misa-Misa 2023-12-17 15:30:23 594 Initial revision (saved to drafts)