How Do I solve problem ADAMOLD on spoj?
Problem: http://www.spoj.com/problems/ADAMOLD/ I unable to think of approach better than O(k*n^2)