0% found this document useful (0 votes)
2K views

The Perfect Team: Physics Chemistry Math Botany Zoology

The document describes a problem to determine the total number of different teams that can be formed from a list of students' skills, where each team consists of 5 students with different skills. It provides examples to illustrate that given the string "pcmbzpcmbz", there are 2 possible teams, and given the string "mppzbmbpzcbmpbmczcz", there are only 3 possible teams that can be formed. The goal is to complete the function perfectTeam that takes in a skills string and returns the number of different teams that can be formed satisfying the constraints.

Uploaded by

hernanes13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

The Perfect Team: Physics Chemistry Math Botany Zoology

The document describes a problem to determine the total number of different teams that can be formed from a list of students' skills, where each team consists of 5 students with different skills. It provides examples to illustrate that given the string "pcmbzpcmbz", there are 2 possible teams, and given the string "mppzbmbpzcbmpbmczcz", there are only 3 possible teams that can be formed. The goal is to complete the function perfectTeam that takes in a skills string and returns the number of different teams that can be formed satisfying the constraints.

Uploaded by

hernanes13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like