Incture Technologies | Coding Round

Question · Posted Sep 2020

Problem - 1 Given an array of N integers A1, A2.....An. Find out the numbers of ways in which you can choose any 3 integers such that they form an arithmetic progression series. Say(i,j,k) is the triplet, such that 1<=i<=j<=k<=N & (Ai-Aj)=(Ak-Aj). That is the difference of the consecutive terms in the triplet (sorted in ascending order is same). Input: First line of the input contain an integer N (3<=N<=100000). Then the following line contains N space separated integers A1,A2,....An ...

The full answer & interview discussion are available to premium members.

Log in Create a free account