MINCARS Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Utkarsh Gupta
Tester: Abhinav Sharma, Nishank Suresh
Editorialist: Pratiyush Mishra

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

A single car can accommodate at most 4 people.

N friends want to go to a restaurant for a party. Find the minimum number of cars required to accommodate all the friends.

EXPLANATION:

For each test case, we are given the number of friends going to the party.

Clearly, for less than 4 friends 1 car is sufficient. Using this logic we can deduce that for N friends the minimum cars required will be: $(N/4)$$+1$

TIME COMPLEXITY:

O(1) for each test case.

SOLUTION:

Editorialist’s Solution
Setter’s Solution
Tester-1’s Solution
Tester-2’s Solution