Next slide
Finding a subsequence
Easy for distance 1: just count
Loop through for each distance d up to n/k
Starting at each position from 0 to d
Count through that substring
Running time:
sum(sum(sum(O(1),b=0..n/d),a=0..d-1),d=1..n/k)
=O(n²/k)