Support roster rotations
A support roster is filled one night at a time. engineer_teams[i] names the team engineer i belongs to, and the run has shifts consecutive nights. A rotation names one engineer per night, so two rotations differ as soon as any single night differs. Two rules apply: consecutive nights must go to engineers from different teams, since a team that just handed off needs the night to recover, and no engineer may cover more than max_shifts nights across the whole run. Return how many rotations satisfy both rules. A run of zero nights has exactly one rotation, the empty one, so return 1 there. The roster holds at most 5 engineers and the run is at most 7 nights.
count_oncall_rotations(engineer_teams: list[str], shifts: int, max_shifts: int) → int[["core","core","edge"],2,2]out4[["core","edge"],3,2]out2[["ops"],1,1]out1State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[["core","core","edge"],2,2]4not run yetsample[["core","edge"],3,2]2not run yetsample[["ops"],1,1]1not run yetsample