Who likes it?
likes [] -- must be "no one likes this"
likes ["Peter"] -- must be "Peter likes this"
likes ["Jacob", "Alex"] -- must be "Jacob and Alex like this"
likes ["Max", "John", "Mark"] -- must be "Max, John and Mark like this"
likes ["Alex", "Jacob", "Mark", "Max"] -- must be "Alex, Jacob and 2 others like this"Kata.Likes(new string[0]) => "no one likes this"
Kata.Likes(new string[] {"Peter"}) => "Peter likes this"
Kata.Likes(new string[] {"Jacob", "Alex"}) => "Jacob and Alex like this"
Kata.Likes(new string[] {"Max", "John", "Mark"}) => "Max, John and Mark like this"
Kata.Likes(new string[] {"Alex", "Jacob", "Mark", "Max"}) => "Alex, Jacob and 2 others like this"* return must be an allocated string
* do not mutate input
likes({})
// should return "no one likes this"
likes({"Peter"})
// should return "Peter likes this"
likes({"Jacob", "Alex"})
// should return "Jacob and Alex like this"
likes({"Max","John","Mark"})
// should return "Max, John and Mark like this"
likes({"Alex", "Jacob", "Mark", "Max"})
// should return "Alex, Jacob and 2 others like this"Solutions
π Python
Last updated