Question: Train Breaking Problem Submissions Leaderboard Discussions There is a train with N cars connected to each other using connectors. Assume: the connector location 1 is
Train Breaking Problem Submissions Leaderboard Discussions There is a train with N cars connected to each other using connectors. Assume: the connector location 1 is between the first and second cars. You are given a sorted list of connector locations, and required to find the order of locations to break the train at all the specified locations in L while getting the minimum total cost. Breaking a train of length x costs x. You are required to answer the question above using dynamic programming. Input Format The first line contains the number of train cars The second line contains the number of required breaks M (the list size) . The third line contains M integers representing the locations of the required breaks Constraints INS1015 OSMCN OS M
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
