Company: wayfair_26oct
Difficulty: medium
Minimum Cost Problem Description There are n points on the x-axis (1, 2, ..., 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 of at most k . Complete the function getMinimumCost in the editor. The function is expected to return a long_int and accepts the following parameters: cost : an integer array representing the cost incurred at each point. (Note: The cost array is 0-indexed, where cost[j] corresponds to the cost of point j+1 ). k : an integer representing the maximum jump length. /* * Complete the 'getMinimumCost' function below. * * The function is expected to return a LONG_INTEGER. * The function accepts following parameters: * 1. INTEGER_ARRAY cost * 2. INTEGER k */ long getMinimumCost(vector<int> cost, int k) { } Examples Example 1: Input: n =