Subsequence And Subarray Javascript Interview Coding Question