Manafall Daily Quest

Labyrinth Escape

Function Name: findEscapeRoute

Description

Write a function 'findEscapeRoute' that determines if there is a way out of a labyrinth represented as a 2D grid. The labyrinth is a matrix of characters where 'O' represents open passages, 'X' represents walls, and 'E' represents the exit. The function should take two parameters: a matrix of characters representing the labyrinth, and a tuple or an array representing the starting position (row, column). The starting position will always be an open passage. The function should return a boolean value indicating whether there is a way to reach the exit 'E' from the starting position. The movement is restricted to up, down, left, and right and cannot pass through walls.

Requirements

  • The function should return true if there is an escape route, false otherwise.
  • Do not use any third-party libraries or built-in pathfinding algorithms.
  • Assume the labyrinth is enclosed by walls except for the 'E' exit, i.e., you cannot escape from any side edges unless there is an 'E'.
  • If the starting position is the exit ('E'), the function should return true.
  • The function must handle labyrinths of different sizes but can assume valid input with only 'O', 'X', and one 'E'.

Examples

Example: For a labyrinth represented as below, and starting position (1, 1):[['X', 'O', 'X', 'X', 'X'], ['X', 'O', 'O', 'O', 'X'], ['X', 'X', 'X', 'O', 'X'], ['X', 'E', 'X', 'O', 'X'], ['X', 'X', 'X', 'X', 'X']]Calling findEscapeRoute(labyrinth, (1,1)) should return true.

Links

https://en.wikipedia.org/wiki/Maze_solving_algorithm

Sequential Digits

Fri Dec 20 2024

Create a function named sequentialDigits that takes two integers, low and high as input and returns a list of all the integers that contain sequential digits, where each digit is exactly one larger than the previous digit, and the integers are between the range of low and high (inclusive). The output list should be sorted in increasing order.

Prev Quest

Even Odd Partition

Sun Dec 22 2024

Create a function named 'partitionEvenOdd' which takes a list of integers as its only parameter.The function should partition the list into two separate lists: one containing all even numbers, the other containing all odd numbers.The function should then return a tuple of these two lists.The original ordering of the numbers in the input list should be preserved.

Next Quest