Skip to content

dotnetYork/NationWord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NationWord

Completed by dotnetYork on 2020-0717

Task 1

For a given input, write a function that return the number of times the letter 'a' can be added to it before the string 'aaa' is present in the word e.g. for the string aabab, the letter 'a' can be added three times so as to make aabaabaa, so your function should return 3.

More sample inputs
The string 'dog' can become 'aadaaoaagaa', so your function should return 8. The string 'baaaa' already contains 'aaa', in this case your function should return -1.
The string 'aa' cannot have any 'a's added to it before it becomes 'aaa', in this case your function should return 0.

Task 2

For a given array of strings, write a function that calculates the length of the longest string that can be assembled by combining elements of the array and that does not contain any repeated letters.

Sample inputs
If the array is 'ezy', 'jnx', 'btp' the longest string that can be assembled is 9 characters long. If the array is made up of 'co', 'dil' and 'ity', the longest strings that can be produced are codil, coity, dilco and ityco, so your function should return 5.
If the array is made up of 'banana', 'racecar' and 'potato', there are no strings that can be assembled without repeating letters, so your function should return -1.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages