Manafall Daily Quest

Symmetric Tree Check

Function Name: isSymmetricTree

Description

Write a function that takes the root node of a binary tree as its parameter and returns a boolean indicating whether the tree is symmetric around its center. A binary tree is considered symmetric if it can be divided into two halves that are mirror images of each other.

The function should handle trees with any number of nodes, and nodes may have the value of any integer.

A tree with zero nodes (empty tree) should be considered symmetric.

Requirements

  • The function must be named isSymmetricTree.
  • The function should take a single parameter, which represents the root node of a binary tree.
  • The function must return a boolean value.
  • Do not use any external libraries or packages.
  • Consider the tree data structure and how nodes are represented in code.
  • If necessary, you can define auxiliary functions to help in your implementation.

Examples

Given a binary tree represented as:    1   / \  2   2 / \ / \3  4 4  3The isSymmetricTree function should return true since it's symmetric.If the tree is adjusted as follows:    1   / \  2   2   \   \   3    3The isSymmetricTree function should return false because it's not symmetric.

Links

https://en.wikipedia.org/wiki/Binary_treehttps://www.tutorialspoint.com/data_structures_algorithms/tree_data_structure.htm

Prime Time

Tue Dec 31 2024

Write a function called isPrimeTime that determines whether the provided time (hours and minutes) can be represented as a prime number when concatenated. For instance, 15:31 would become 1531, and you would need to determine if 1531 is a prime number or not. Hours should be in the range of 0 to 23, and minutes should be in the range of 0 to 59. The function should not consider leading zeroes (e.g., 03:07 should be treated as 307).

Prev Quest

Stock Span Calculator

Thu Jan 02 2025

Write a function that calculates the span of stock’s price for all days. The span of the stock's price today is defined as the maximum number of consecutive days (starting from today and going backwards) for which the price of the stock was less than or equal to today's price.For example, if the list of stock prices was [100, 80, 60, 70, 60, 75, 85], then the function should return the spans as [1, 1, 1, 2, 1, 4, 6].

Next Quest