Question: In a car factory there are two assembly lines, called A and B . Each of them consists of N positions numbered from 0 to
In a car factory there are two assembly lines, called A and Each of them consists of positions numbered from to In each position, some component is installed
into the car being assembled. The lines are symmetric; that is the same component is installed into the car in the corresponding positions of A and B
In order to assemble a car, it needs to get through all of the positions on the assembly lines. It takes minutes to install the component in the Kth position on line and
minutes to install it on line
After installing a component in the Kth position, the car can either be moved to the next position on the same line which happens automatically and takes
tes or it
can be moved to the other line. Switching from line A to line B takes minutes, and switching from line to line A takes minutes.
The assembly process can be started in either line.
Write a function:
def solution
that, given arrays A and consisting of integers each, and integers and returns the minimum time required to assemble an entire car.
Examples:
Given and the function should return The assembly of the car can start in line A After installing the component in position number
minute the car can be moved to assembly line minutes to install the component in position number minutes and move the car back to line A minute where
the last component would be installed minutes The total time is
Given and the function should return It is optimal to assemble the entire car on line A
Given and the function should return
Given and the function should return
Write an efficient algorithm for the following assumptions:
is an integer within the range ;
each element of arrays A and B is an integer within the range ;
and are integers within the range
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
