Question: There are N cities ( numbered from 1 to N , from left to right ) arranged in a row and N - 1 one
There are N cities numbered from to N from left to right arranged in a row and N oneway roads between them: NN
The government has a plan to build M new roads. The roads will be built one by one. The Kith road will connect the AKth city with the BKth city roads are numbered from to M Each road will lead from the left to the right, from a city with a smaller number to a city with a larger number. No two roads will intersect. Formally, there will be no
two roads AB and CD such that A C and its length is After building the second road the shortest path from home to school is: and its length is After building the third road the shortest path from home to school is: and its length is
Given X Y and N the function should return After building the first road the length of the shortest path from home to school is The roads built subsequently do not improve the result
Given x Y and N the function should return Each new road shortens the distance from home to school by
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
