loop invariant practice problems - Search