#2 solved in Julia