Manafall Daily Quest

Even Odd Partition

Function Name: partitionEvenOdd

Description

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.

Requirements

  • The function must take exactly one parameter: a list of integers.
  • The function must return a tuple containing two lists: the first list with even numbers and the second list with odd numbers.
  • The original list must not be modified.
  • Do not use built-in filter functions, solve the problem using basic loop and conditional constructs.
  • The solution should handle an empty list input by returning a tuple of two empty lists.
  • The function should be efficient and handle potentially large lists.

Examples

Calling partitionEvenOdd([12, 34, 45, 9, 8, 90, 3]) should return ([12, 34, 8, 90], [45, 9, 3]).Calling partitionEvenOdd([]) should return ([], []).Calling partitionEvenOdd([1, 3, 5, 7]) should return ([], [1, 3, 5, 7]).

Links

https://www.geeksforgeeks.org/segregate-even-and-odd-numbers/https://en.wikipedia.org/wiki/Parity_of_an_integer

Labyrinth Escape

Sat Dec 21 2024

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.

Prev Quest

Unique Character Mapping

Mon Dec 23 2024

Create a function named isIsomorphic that takes two strings and determines if they are isomorphic. Two strings are isomorphic if the characters in the first string can be replaced to get the second string. The replacement must be consistent for all occurrences of a character and no two characters may map to the same character, but a character may map to itself.

Next Quest