Fast upgraded to not double count subsequence already found
binary search for performance improvement