Anagram Detector
Function Name: isAnagram
Description
Write a function that checks whether two given strings are anagrams of each other. An anagram is a word or phrase that is made by rearranging the letters of another word or phrase. For example, 'heart' and 'earth' are anagrams.
Requirements
- The function must be named isAnagram.
- The function should take two string parameters and return a boolean value: true if the strings are anagrams, and false otherwise.
- The function should not be case-sensitive ('Dormitory' and 'dirty room' should be considered anagrams).
- White spaces should be ignored ('Conversation' and 'voices rant on' should be considered anagrams).
- The function should consider strings with different lengths and return false if the lengths are not the same after considering the above rules.
- Unicode characters should be properly handled. Ensure that multi-byte characters such as emojis are accounted for correctly.
Examples
isAnagram('listen', 'silent') // returns trueisAnagram('hello', 'billion') // returns falseisAnagram('Dormitory', 'dirty room') // returns trueisAnagram('𝒜𝓃𝑔𝑒𝓁', '𝒢𝓁𝑒𝓃𝒶') // returns false (considering Unicode characters)
Links
Fibonacci Nth Number
Wed Sep 18 2024
The Fibonacci sequence is a series of numbers where the next number is found by adding up the two numbers before it. The sequence starts with 0 followed by 1, and each subsequent number is the sum of the previous two.Your task is to write a function named 'fibonacciNth' that calculates the nth number in the Fibonacci sequence.- The function should be efficient and should handle large values of 'n'.- You may not use any libraries or built-in functions that directly compute the Fibonacci sequence. Implement the calculation from scratch using your understanding of the sequence.
Unique Paths Calculator
Fri Sep 20 2024
Create a function that calculates the number of unique paths from the top-left corner to the bottom-right corner of a m x n grid. The only movements allowed are to move right or down at any given point. The function will take two parameters: the number of rows (m) and the number of columns (n). It should return the number of unique paths possible.Constraints:1. You may not use any third-party libraries.2. Optimize the function for time complexity.3. Extra challenge: Use only O(n) extra space for the solution, where n is the number of columns.