What Will Be The Output Of The Following Codep Pre Langc #416

What will be the output of the following code?</p> <pre><code class="language-c"> #include <bits/stdc++.h> using namespace std; int func(int arr[], int s, int e) { if (s == e) return 0; if (arr[s] == 0) return INT_MAX; int min = INT_MAX; for (int i = s + 1; i <= e && i <= s + arr[s]; i++) { int jumps = func(arr, i, e); if(jumps != INT_MAX && jumps + 1 < min) min = jumps + 1; } return min; } int main() { int arr[] = {1, 3, 6, 3, 8, 5}; int n = sizeof(arr)/sizeof(arr[0]); cout << func(arr, 0, n-1); return 0; } </code></pre>

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs121 Data Structures and Algorithms. It can also be found in gs gs121 Array Types - Number of Jumps to Reach End-array Operation - Quiz No.1.


Similar question(s) are as followings:



Online Quizzes of gs121 Data Structures and Algorithms

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background