Given a mouse in a grid, determine if mouse can reach the cheese. The only way to manipulate the mouse is via two functions, move() and isCheese(). move() returns true and moves the mouse if the move is possible, and returns false otherwise. isCheese() returns true if the mouse is currently at the cheese and false otherwise. You only have one instantiation of the mouse class. You cannot access the graph outside of the methods provided. The graph may have walls and isn’t guaranteed to be any particular shape. Exactly one cheese exists, and it’s always possible to reach it.
Help Mouse Find the Cheese
Given a mouse in a grid, determine if the mouse can reach the cheese. The only way to manipulate the mouse is via two functions, move() and isCheese(). The move() function returns true and moves the mouse if the move is possible, and returns false otherwise. The isCheese() function returns true if the mouse is currently at the cheese and false otherwise. You only have one instantiation of the mouse class. You cannot access the graph outside of the methods provided. The graph may have walls and isn’t guaranteed to be any particular shape. Exactly one cheese exists, and it’s always possible to reach it.
Onde essa pergunta já apareceu
Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.
Materiais associados
Nenhum anexo público associado a esta pergunta.
Depois de treinar essa pergunta, vale abrir outras do mesmo tipo e da mesma senioridade para comparar padrões de resposta.
Isso ajuda a sair da memorização de uma resposta só e entrar em repertório real de entrevista.
Continue a preparação com o banco completo
No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.