Home / MCQ Bank / Computer
Computer Dynamic Programming In Data Structures Difficulty: Medium

What is the output of the following program? #include<stdio.h> #include<limits.h> int min_jump(int *arr, int len) { int j, idx, jumps[len]; jumps[len - 1] = 0; for(idx = len - 2; idx >= 0; idx--) { int tmp_min = INT_MAX; for(j = 1; j <= arr[idx] && idx + j < len; j++) { if(jumps[idx + j] + 1 < tmp_min) tmp_min = jumps[idx + j] + 1; } jumps[idx] = tmp_min; } return jumps[0]; } int main() { int arr[] ={9, 9, 9, 9, 9, 9, 9, 9, 9},len = 9; int ans = min_jump(arr,len); printf("%d\n",ans); return 0; }

Select the correct option to test your answer:

More Computer Questions

Which of the following clauses is used to display information that match a given pattern? What will be the output of the following Python code? >>> a=[(2,4),(1,2),(3,9)] >>> a.sort() >>> a Why to prefer red-black trees over AVL trees? What will be the output of the following Python code? for i in range(int(float('inf'))): print (i) What is the space complexity of quick search algorithm?