Using another way to find out the actual subsequence without extra array