Given an unsorted array of integers.
I'm trying to come up with an efficient solution (better than O(n2)) but the best I can come up with is an O(n2) solution:
for i from 0 to size of list:
sum = list[i]
for j from i + 1 to size of list:
sum += list[j]
if sum % (j - i + 1) == 0:
return true
return false
I've read stuff on sliding window technique, but it looks like that would be useful for subarrays of a specific length k.