Fibonacci Finder
Function Name: fibonacci_at_index
Description
Write a function named `fibonacci_at_index` that takes one integer parameter, `n`,
and returns the nth number in the Fibonacci sequence, where the sequence starts with 0 (zero based indexing).
The Fibonacci sequence is defined by the following recurrence relation:
F(0) = 0, F(1) = 1,
F(n) = F(n - 1) + F(n - 2)
for n > 1. Your solution should be efficient enough to handle values of `n` up to 30 without
significant performance degradation. Avoid recursion that can lead to a stack overflow, or inefficient
computations that lead to long processing times.
Requirements
- The function `fibonacci_at_index` must take a single integer parameter.
- It should return a single integer, the nth Fibonacci number.
- Implement the function without using any built-in library functions for handling Fibonacci numbers.
- The function should be optimized to handle at least `n` up to 30 efficiently.
- Do not use recursion. Consider iterative methods or memoization to avoid performance issues.
Examples
Example 1: fibonacci_at_index(5) should return 5.Example 2: fibonacci_at_index(9) should return 34.
Links
Array Quadruplet
Thu Oct 24 2024
Write a function called 'findQuadruplet' that finds a quadruplet of numbers in a given array that sum up to a given target sum. A quadruplet is a group of four numbers that are part of the array. The function should return an array of these four numbers in any order. If there is no such quadruplet present in the array, the function should return an empty array.
Balanced Parentheses
Sat Oct 26 2024
Write a function that takes a string containing only parentheses '()', '[]', and '{}' characters. The function must check whether the parentheses in the string are correctly balanced. Every opening parenthesis must have a corresponding closing parenthesis of the same type, and parentheses must close in the correct order. Your function should return true if the string is balanced, otherwise, return false.