Consecutive Subsequences Hackerrank Solution