An Interview Problem

Правка en4, от 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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Misa-Misa 2023-12-17 15:33:41 0 (published)
en3 Английский Misa-Misa 2023-12-17 15:33:10 15
en2 Английский Misa-Misa 2023-12-17 15:32:45 87
en1 Английский Misa-Misa 2023-12-17 15:30:23 594 Initial revision (saved to drafts)