O61
Split Array into Consecutive Subsequences
Problem Statement & Objective
Determine if you can split array into one or more subsequences such that each is consecutive and length >= 3.
Function Signature (Python)
split_array_into_consecutive_subsequences(hand: list[int], group_size: int) -> boolInput & Output Contract
Output Rule:True veya False.
System Constraints
1 <= el.length <= 10^4
0 <= el[i] <= 10^9
1 <= grup_boyutu <= el.lengthExample Execution Walkthrough
el = [1, 2, 3, 6, 2, 3, 4, 7, 8], grup_boyutu = 3
[1, 2, 3], [2, 3, 4], [6, 7, 8] -> TrueExample Test Scenarios (3)
Example 1: Valid
Input:
[[1,2,3,6,2,3,4,7,8],3]Expected Output:
trueExample 2: 5 eleman 4'e bölünmez
Input:
[[1,2,3,4,5],4]Expected Output:
falseExample 3: İki Tam Grup
Input:
[[1,1,2,2,3,3],3]Expected Output:
true