Company: Wayfair_28oct
Difficulty: medium
Minimum Cost Problem Description There are n points on the x-axis (1, 2, 3, ..., n), where the i th point has a cost associated with it denoted by cost[i] . Starting from coordinate x = 0 , you can make jumps of length at most k . Whenever you stop at a point, you incur the cost of that point. Find the minimum cost to reach point n by taking jumps of length at most k . Complete the function getMinimumCost in the editor with the following parameters: int cost[n] : the cost incurred at each point int k : the maximum jump length Returns long_int : the minimum total cost incurred to reach point n Examples Example 1: Input: n = 5, cost = [4, 3, 9, 3, 1], k = 2 Output: 7 Explanation: The optimal jump pattern is 0 → 2 → 4 → 5. The cost of stopping at points 2, 4, and 5 is 3 + 3 + 1 = 7, which is the minimum possible. Example 2: Input: n = 4, cost = [1, 2, 3, 4], k = 2 Output: 6 Explanation: The optimal path is 0 → 2 → 4, 2 + 4 = 6. Example 3: Input: n = 5, cost = [1, 9, 2, 6, 1], k = 3 Output