Choosing a Fleet of Vehicles
Given an integer denoting a total number of wheels, find the number of different ways to choose a fleet of vehicles from an infinite supply of two-wheeled and four-wheeled vehicles such that the group of chosen vehicles has that exact total number of wheels. Two ways of choosing vehicles are considered to be different if and only if they contain different numbers of two-wheeled or four-wheeled vehicles.
For example, if our array wheels = [4,5,6] our return array would be res = [2, 0, 2]. Case by case, we can have 1 four-wheel or 2 two-wheel to have 4 wheels. We cannot have 5 wheels. We can have 1 four-wheel and 1 two-wheel or 3 two-wheel vehicles in the final case.
Complete the function chooseFleets in the editor below. The function should return an array of integers representing the answer for each wheels[i].
chooseFleets has the following parameter(s):
wheels[wheels[0],...wheels[n-1]]: an array of integers
1Example 1
Constraints
Limits and guarantees your solution can rely on.
1 ≤ n ≤ 1051 ≤ wheels[i] ≤ 106