Hello codeforces community . I was stuck in this problem was quite sometime . So decided to view the editorial . LINK . I completely understood the editorial but having a hard time understanding why it works . What is the reason behind this. I'll try to explain the method: — we will start will smallest a[i] and for each a[i] we will run a loop from ( j= 2*a[i] till 2*maximum_element_of_array with increment of a[i] (just like sieve) at each j we will find the number which is JUST less than this j present inside the array .If this number j compares greater than a[i] we will store the result in the variable ans . REFERENCE SOL Thank you . plz help me out :)