I'll start with my personal favorite question I've ever been asked:
I like mazes. Generate me an interesting maze.
I like that there are a multitude of ways that you can accomplish this.
The solution that I eventually settled on in the interview was a random walk on a 2-D grid which would first try to join the start and end points, and back up a fixed distance if it ever determined that it had walked itself into a corner. Afterwards, it would attempt to fill in the rest of the grid with branching paths by backing up the walked path and following a similar random walk until it had nowhere left to go, at which point it would return to the main path and continue filling in more blank portions of the grid.
I'm not sure if it generates the most interesting mazes, since I'm relatively certain that the correct path would be rather visible, as it probably ends up drawing a relatively straight line between the start and end points. Maybe I should try to code this up some time and see how it looks 😂
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'll start with my personal favorite question I've ever been asked:
I like that there are a multitude of ways that you can accomplish this.
The solution that I eventually settled on in the interview was a random walk on a 2-D grid which would first try to join the start and end points, and back up a fixed distance if it ever determined that it had walked itself into a corner. Afterwards, it would attempt to fill in the rest of the grid with branching paths by backing up the walked path and following a similar random walk until it had nowhere left to go, at which point it would return to the main path and continue filling in more blank portions of the grid.
I'm not sure if it generates the most interesting mazes, since I'm relatively certain that the correct path would be rather visible, as it probably ends up drawing a relatively straight line between the start and end points. Maybe I should try to code this up some time and see how it looks 😂