A class has students with various talents, each represented by an integer from 1 to talentsCount. You need to form teams for a quiz competition, where each team must have at least one member with each talent.
Teams must be formed from consecutive students in the array. For each possible starting position, determine the minimum number of students needed to form a valid team. If it is not possible to form a team with all talents from a particular starting position, return -1 for that position.
