Company: Microsoft_21_jan
Difficulty: medium
Minimum Cost to Reach Point n Minimum Cost to Reach Point n Problem Description There are n points on the x-axis, labeled 1, 2, 3, ..., n . You are also given a 0-indexed integer array cost of size n , where cost[i-1] is the cost to land on point i . You start at point 0. From any point x , you can make a jump to any point y such that x < y ≤ x + k . The total cost of a path is the sum of the costs of all the points you land on. Find the minimum total cost to reach point n . Example n = 5 cost = [4, 3, 9, 3, 1] k = 2 The optimal jump pattern is 0 → 2 → 4 → 5. The cost of stopping at points 2, 4, and 5 is the sum of cost[1] , cost[3] , and cost[4] , which is 3 + 3 + 1 = 7. This is the minimum possible cost. Function Description Complete the function getMinimumCost . The function must return the minimum total cost to reach point n . getMinimumCost has the following parameters: vector<int> cost : A 0-indexed array of integers where cost[i] is the cost to land on