Is Fibo Solution

You are given an integer, N. Write a program to determine if N is an element of the Fibonacci sequence.
The first few elements of the Fibonacci sequence are 0, 1, 1, 2, 3, 5, 8, 13….

Rectangular Game Solution

You are given an infinite 2d grid with the bottom left cell referenced as (1,1). All the cells contain a value of zero initially. Let’s play a game?
The game consists of N steps wherein each step you are given two integers a and b.

Fibonacci Numbers in O(logn) [Matrix Exponentiation]

Matrix multiplication can be performed in O(logn) by using matrix exponentiation. It is one of the most used techniques

Fibonacci Numbers Solution (O(1) auxiliary space)

To find the nth fibonacci number, we need not store previous Fibonacci numbers in an array. We could use two temporary variables instead of an array to store previous fibonacci numbers

Pascal’s Triangle

In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients. It can also be viewed as: each number in Pascal’s triangle is the sum of the two numbers directly above it.

Minimum number of moves to equal array elements – LeetCode Solution [Medium]

Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment n – 1 elements of the array by 1.

Implementing basic Mathematical operations (Euclidean algorithm for GCD)

Given two non-negative integers a and b, you’ve to find the Greatest Common Divisor (GCD) or Highest Common Factor (HCF) of the two numbers. In other words, find the largest number that divides them both. The Euclidean algorithm is one of the oldest numerical algorithms to compute the greatest common divisor (gcd) of two positive integers.

Implementing basic Mathematical operations (Exponential)

Drawback of this method is that it will cause int overflow. This is because pow( ) method will calculate the exponential before taking the modulo.

Matrix-chain multiplication

We are given a sequence (chain) (M1, M2, M3…Mn) of n matrices to be multiplied and we need to find the most efficient way to multiply these matrices together.

Strassen’s Algorithm for Matrix multiplication

Strassen’s Algorithm for Matrix multiplication is a recursive algorithm for multiplying n x n matrices. Strassen’s algorithm is based on a familiar design technique – Divide & Conquer.