Hey, so I need to write an algorithm that will do the following and run in O(n):

Search linearly through an array of size n and for each element check whether array*>array[i-k] for all k=1,2,...n/5.*

Its easy to do this with two loops but I cant figure out how to do this in O(n).