## Strassen’s Algorithm for Matrix multiplication

Strassen’s Algorithm for Matrix multiplication is a recursive algorithm for multiplying n*n matrices in O(n^lg(7)) ie O(n^2.81) time. It outperforms the naive O(n^3) matrix multiplication algorithm. Naive Matrix-Multiplication (A, B) Pseudocode 1. n = Length[A] 2. C = n x n matrix 3. for i = 1 to n 4. do […]

## How to find k nearest neighbors of a given point from a set of points in a plane?

Problem Statement Let’s given n points in a plane. We’ve to find k nearest neighbors of a given point ‘p’ from the given n points. Problem Naive Solution O(nlogn) Let’s call the given point be P and set of points be S. Iterate over S and find euclidean distance between each […]

## Sieve of Eratosthenes | HackerRank Solution

The sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking numbers in the range as composite by marking the multiples of each prime as non-prime.

## Multiset Partitioning Problem

In mathematics, a partition of a set is a grouping of its elements into non-empty subsets, in such a way that number of elements in the original set always equals to the sum of number of elements in each partition. Equivalently, a family of sets P is a partition of X if and only if […]

## A Chocolate Fiesta | HackerRank

Welcome to the exciting class of Professor Manasa. In each lecture she used to play some game while teaching a new concept. Today’s topic is Set Theory. For today’s game, she had given a set A = {a1, a2, …aN} of N integers to her students and asked them to play the game as follows. […]