Manafall Daily Quest

Area Code Extractor

Function Name: extractAreaCodes

Description

Create a function named 'extractAreaCodes' that takes a string containing multiple phone numbers and extracts the area codes. Phone numbers can be in various formats, but area codes will always be the first three digits after an optional '+' and country code, or immediately following an opening parenthesis '('.

The function should return a list of unique area codes in the order they appeared in the input string. Consider only extracting valid area codes (ranging from 200 to 999).

Ignore any phone numbers that do not have a clear area code and handle varying formats and separators gracefully.

Requirements

  • The function must take a single string parameter that may contain multiple phone numbers.
  • The area codes must be extracted as strings and added to a list if they are not already present (no duplicates).
  • Only valid area codes (200-999) should be considered and returned.
  • Manage various phone number formats like '+123 (456) 789-0123', '456-789-0123', or '(456) 789-0123'.
  • The function should be case-insensitive and handle input with varying cases.
  • The function should ignore any characters that are not digits when determining the position of the area code.

Examples

extractAreaCodes('Call me at +123 (456) 789-0123 or (321) 456-7890.') returns ['456', '321']extractAreaCodes('My numbers are 456-789-0123 and 123.456.7890 and also (456)234-8901') returns ['456', '123']

Links

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

Recursive Fibonacci Finder

Fri Aug 02 2024

Write a function that computes the nth Fibonacci number. The Fibonacci sequence is characterized by the fact that every number after the first two is the sum of the two preceding ones. This function should use recursion to calculate the Fibonacci number. By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two.

Prev Quest

Anagram Detector

Sun Aug 04 2024

An anagram is a word or phrase that's formed by rearranging the letters of another word or phrase. For example, 'listen' is an anagram of 'silent'.Write a function 'areAnagrams' that takes two strings and returns a boolean indicating whether or not they are anagrams of each other.The comparison should be case-insensitive and should disregard any non-alphabetical characters.The function should focus on performance for larger strings.

Next Quest