in Algorithms retagged by
1,475 views
0 votes
0 votes
Given a sequence of n real numbers a1,a2,a3...an then to find contiguous subsequence ai,ai+1,ai+2....aj. Such that it's sum is maximum. How much time the above problem will take if you use dynamic programming?
in Algorithms retagged by
1.5k views

1 Answer

1 vote
1 vote

time complexity=O(n)

space complexity=O(n)(we can improve it to O(1))

https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/

Related questions

1 vote
1 vote
1 answer
1