Recursive Fibonacci Finder
Function Name: findFibonacci
Description
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.
Requirements
- The function must be implemented using recursion.
- The function takes one integer parameter, n, which represents the position in the Fibonacci sequence (with the first position starting at 0).
- The function should return the nth Fibonacci number.
- Do not use loops; the solution must be recursive.
- Optimize the function for performance to avoid a long execution time for large values of n.
- Take into account that the function should handle the basic cases of n = 0 returning 0 and n = 1 returning 1.
Examples
If n is 5, then findFibonacci(5) should return 5 because the sequence is: 0, 1, 1, 2, 3, 5.If n is 10, then findFibonacci(10) should return 55.
Links
Prime Factorization
Thu Aug 01 2024
The task is to write a function named 'primeFactorize that takes a single integer parameter and returns an array or list of its prime factors (including multiplicity).A prime factor is a factor that is a prime number, and prime factorization of a number is a list of prime numbers that multiply to the number.The function should handle erroneous and edge cases gracefully, such as negative inputs, zero, and one, by returning an empty list or array.
Area Code Extractor
Sat Aug 03 2024
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.