Subsequence And Subarray Javascript Interview Question