Manafall Daily Quest

Anagram Checker

Function Name: isAnagram

Description

The function isAnagram should take two strings as parameters and determine if they are anagrams or not. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. For example, 'listen' is an anagram of 'silent'. The comparison should be case insensitive and ignore all spaces.

Requirements

  • The function must take exactly two string parameters.
  • The solution must disregard cases and spaces, considering only the alphanumeric characters.
  • The function should return a boolean value: true if the strings are anagrams, false otherwise.
  • Empty strings or strings with no alphanumeric characters should be considered non-anagrams.
  • The function should be efficient to handle long strings.

Examples

isAnagram('listen', 'silent') // returns trueisAnagram('Hello World', 'Dworel Llloh') // returns trueisAnagram('Triangle', 'Integral') // returns trueisAnagram('lamp post', 'post lamp') // returns trueisAnagram('', '   ') // returns falseisAnagram('apple', 'ppl') // returns false

Links

https://en.wikipedia.org/wiki/Anagramhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

Subarray Sum Equals K

Mon Nov 18 2024

Write a function called subarraySum that finds the total number of continuous subarrays whose sum equals to an integer k.The function should take an array of integers and the integer k as parameters.Return the count of such subarrays.

Prev Quest

Path Sum in Binary Tree

Wed Nov 20 2024

In this challenge, you are given the root of a binary tree and an integer target sum. Write a function that checks if the tree has a root-to-leaf path such that adding up all the values along the path equals the target sum.A leaf is a node with no children.Your function should return true if such a path is found, or false otherwise.

Next Quest