added solution for rota critica