Given an integer array nums sorted in non-decreasing order, return true if it is possible to split nums into one or more subsequences such that each subsequence consists of consecutive integers and has a length of at least 3.
Greedy with two frequency maps: freq (remaining count) and tail (count of subsequences ending at each value). For each num, prefer extending an existing subsequence ending at num-1; else start a new one (needs num+1 and num+2).
- freq: count of each number.
- tail: count of subsequences ending at each value.
- For each num (in order): if freq[num]==0 skip.
- If tail[num-1]>0: extend that subseq, tail[num-1]--, tail[num]++.
- Else: start new with num, num+1, num+2 (check freq), tail[num+2]++.
- If neither possible: return false.
- Time Complexity: O(N)
- Space Complexity: O(N)