Help with an interesting problem? Looks straightforward but I failed to do it today during online assessment.

Revision en1, by Vik, 2021-02-13 20:13:08

Constraints:

Size of the array: [1 10^5]

Element: 1 <= a[i] <= 10^6

Brute force won't work because of the constraints. I tried thinking of various ways but all were convoluted. I feel there is an easier way to think about it but I am missing some observation.

Any help would be highly appreciated.

Thanks!

Tags #arrays, #constructive algorithms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Vik 2021-02-13 20:14:30 81
en1 English Vik 2021-02-13 20:13:08 431 Initial revision (published)