Solution. Maybe slow
Correct solution. A bit slow