Add O(n)/O(1) solution to the findM problem