ex. ch3 : improve hasSubsequence after review