HackerRank Day 21: Generics problem solution - TheCScience