Select the correct option to test your answer:
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; }
More Computer Questions
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int i = 3; int l = i / -2; int k = i % -2; cout << l << k; return 0; }
What does the rmarkdown package in R facilitate?
How do you find the number of days between two Date objects in Ruby?
Malicious software is known as____________?
Identify the count of mistakes in the following markup. <html> <head> </head> <body> <li> <ul><p> Hello </p></ul> </li> <br> <hr> </body> </html>