Longest arithmetic progression in a sorted array

Problem Given a sorted array, find the longest arithmetic progression in the same. Solution Method 1 - Dynamic Programming Before solving this problem, let us solve a different problem first. How to find if a sorted array contains an arithmetic progression of length 3? This can be done by looping over the array and then finding numbers ‘i’ and ‘k’ on either side of current number ‘j’ such that ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy