HackerRank https://www.hackerrank.com/test/1qte8k5fer4/que...
1m 20s
left Language C++
3. The Perfect Team 1 #include <bits/stdc++.h> ⋯
ALL 6
7 /*
The School of Languages and Science 8 * Complete the 'perfectTeam'
teaches five subjects: Physics, Chemistry, 9 *
Math, Botany, and Zoology. Each student 10 * The function is expected to
is skilled in one subject. The skills of the 11 * The function accepts STRING
students are described by string of named 12 */
skills that consists of the letters p, c, m, b, 13
and z only. Each character describes the 14 int perfectTeam(string skills
1 15
skill of a student.
16 }
17
2 Given a list of students' skills, determine
18 int main() ⋯
the total number of different teams
satisfying the following constraints:
3
A team consists of a group of exactly five
4 students.
Each student is skilled in a different
subject.
A student may only be on one team.
Example 1
skills = pcmbzpcmbz
There are 2 possible teams that can be
formed at one time: skills[0-4] = pcmbz
and skills[5-9] = pcmbz, for example.
Example 2
skills = mppzbmbpzcbmpbmczcz
Line: 6 Col: 1
Test Custom
The sorted string is Run
bbbbcccmmmmppppzzzz. All of the skills Results Input
are represented, but there are only 3
students skilled in Chemistry. Only 3
teams can be created.
Function Description
1 of 1 Complete the function differentTeams in 12/19/20, 7:22 PM