Skip to content
Related Articles

Related Articles

GATE | GATE CS 1997 | Question 61
  • Last Updated : 25 Oct, 2017

An array A contains n≥1 positive integers in the locations A[1], A[2],… A[n]. The following program fragment prints the length of a shortest sequence of consecutive elements of A, A[i], A[i+1],…A[j] such that the sum of their values is ≥M, a given positive number. It prints ‘n+1’ if no such sequence exists. Complete the program by filling in the boxes. In each case use the simplest possible expression. Write only the line number and the contents of the box.



Quiz of this Question


My Personal Notes arrow_drop_up