Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.

book
Visiting Circus

Groups of schoolchildren wants to visit Circus after their lessons. Each group consists of a certain number of children (between 1 and 4), and all children in a group must travel together in the same taxi. Each taxi can hold up to four passengers, and multiple groups can share a taxi as long as the capacity allows. Find the minimum number of taxis needed to transport all the children without splitting any group.

Example 1

Input:

[1, 2, 4, 3, 3]

Output:

4
main.cpp

main.cpp

C++

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt