Question: 5 Problem 5 Extra Credit 10 points Consider the following problem: INPUT: An array A of length n. OUTPUT: A pair of indices (i, j),

5 Problem 5 Extra Credit 10 points Consider the following problem: INPUT: An array A of length n. OUTPUT: A pair of indices (i, j), with j > i such that Cl- = A[i] + A[i+1] + ... + A[j] = 100, or "no solution" if no such pair of indices exists. (If there exist many such pair of indices i, j, you only have to return one of them.) Give an O(n) time algorithm for this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
