Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Arithmetic series -Google Interview Question

$
0
0

Given an array of integers A, give an algorithm to find the longest Arithmetic progression in it, i.e find a sequence i1 < i2 < … < ik, such that A[i1], A[i2], …, A[ik] forms an arithmetic progression, and k is the largest possible length.

The sequence S1, S2, …, Sk is called an arithmetic progression if Sj+1 – Sj is a constant.


Viewing all articles
Browse latest Browse all 40121

Latest Images

Trending Articles



Latest Images