Update: Codewars solution 1