How to solve the Codewars's Who likes it?

Today I try to solve the algorithm problem of codewars.

Description

You probably know the “like” system from Facebook and other pages. People can “like” blog posts, pictures or other items. We want to create the text that should be displayed next to such an item.

Examples

  • likes {} -> “no one likes this”

  • likes {“Peter”} -> “Peter likes this”

  • likes {“Jacob”, “Alex”} -> “Jacob and Alex like this”

  • likes {“Max”, “John”, “Mark”} -> “Max, John and Mark like this”

  • likes {“Alex”, “Jacob”, “Mark”, “Max”} -> “Alex, Jacob and 2 others like this”

Code

class Solution {
    public static String whoLikesIt(String... names) {
            # Codewars COC 정책으로 인하여 코드 제거
    }
}
Written on December 7, 2018