5 kyu
Coding 3min : Count animals
73 of 103myjinxin2015
Description:
This is the simple version of Fastest Code series. If you need some challenges, please try the Performance version
Task:
Give you some chars
, and they can combine many animal names.
Return the maximum number of animal names that can be combined by chars.
Animal names have been preload by variable names
One char cannot use twice, for example:
chars="goatcode"
When you got a "dog" first time, chars left "atcoe",
second time you can got a "cat".
result=2
When you got a "goat" first time, chars left "code",
no animals will be found at next time.
result=1
So we should return the maximum number, sc("goatcode")=2
Examples:
names=["dog","cat","bat","cock","cow","pig","fox",
"ant","bird","lion","wolf","deer","bear","frog",
"hen","mole","duck","goat"]
sc("dogcat")=2("dog" and "cat")
sc("bcaatt")=2("bat" and "cat")
sc("dogdog")=2("dog" and "dog")
sc("dopig")=1(only contains one of "dog" or "pig")
some corner case:
sc("goatcode")=2 should return 2("dog","cat"), not 1("goat")
sc("cockdogwdufrbir")=4
should return 4("cow","duck","frog","bird") not 2("cock" and "dog")
Series:
- Bug in Apple
- Father and Son
- Jumping Dutch act
- Planting Trees
- Give me the equation
- Find the murderer
- Reading a Book
- Eat watermelon
- Special factor
- Guess the Hat
- Symmetric Sort
- Are they symmetrical?
- Max Value
- Trypophobia
- Virus in Apple
- Balance Attraction
- Remove screws I
- Remove screws II
- Regular expression compression
- Collatz Array(Split or merge)
- Tidy up the room
- Waiting for a Bus
Puzzles
Games
Similar Kata:
Stats:
Created | Apr 16, 2016 |
Published | Apr 16, 2016 |
Warriors Trained | 385 |
Total Skips | 29 |
Total Code Submissions | 769 |
Total Times Completed | 103 |
JavaScript Completions | 73 |
Haskell Completions | 32 |
Total Stars | 27 |
% of votes with a positive feedback rating | 94% of 39 |
Total "Very Satisfied" Votes | 34 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 6 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 6 kyu |