An Interview Problem

Revision en3, by Misa-Misa, 2023-12-17 15:33:10

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


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.


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

Test Case

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

$$$ANS$$$ = 2


  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)