## Egg Dropping Problem

Today we will be talking about a very famous interview problem which is as follows: Given a certain amount of floors of a building (say k number of floors) and also given certain amount of eggs (say n number of eggs) … What is the least amount of egg drops Read more…

## Maximum value

Question: Given a list of non-negative integers representing the value of each cell, determine the maximum amount of value you can get keeping in mind that you can’t use adjacent cells together. Now in this question, at first you might think of a greedy solution to take the largest element Read more…

## Edit Distance

Question: Find the minimum number of operations required to convert a string X of length n to another string Y of length m. Operations allowed: Insertion Deletion Substitution We can solve this question by solving it’s sub-problem i.e., find the minimum number of operations required to convert a string X[0,…,i] Read more…

## Longest Common subsequence

Question: Given two sequences, find the length of longest subsequence present in both. A subsequence is a sequence of characters of a string generated after deleting some or all characters from that string without changing the order of remaining string characters For example: If we have two string “abcde” and Read more…

## 0-1 Knapsack Dynamic Programming

Question: Given weights and profits of n items, put these items in a knapsack of capacity W to get the maximum total profit. 0-1 property:  You can either pick the item or not. Also you have only one copy of each item. Let’s solve this question first using brute force Read more…

## Heap Sort

Heap sort is one of the fastest sorting algorithms. It uses binary heap data structure and its time complexity is O(Log n). In this sorting algorithm, we first build a heap using the given elements. If we want to sort the elements in ascending order, we create a Min Heap. Read more…

## Quick Sort

Quick sort is one of the efficient sorting that is based on splitting the array into the smaller ones. Like merge sort, quick sort also uses divide and conquer approach to sort the element. It chooses the pivot element and partition the given array. Time complexity of Quick sort is Read more…

## Merge Sort

Merge Sort one of the most famous sorting algorithm that uses divide and conquer technique. Merge Sort divides the problem into sub problems and those sub problems are further divided into more sub problem and so on. Once the solution is ready, we combine the sub problems and get sorted Read more…

## Selection Sort

Selection sort is noted for its simplicity, specially an in-place comparison sort. It has O(n^2) time complexity, inefficient on larger lists. The algorithm proceeds to find out the minimum element from the list and exchanged with the left most element and similarly finds second minimum element and exchanged with the Read more…

## Bubble Sorting

Bubble sort is one of the simplest sorting algorithms but yet it is powerful. Bubble sort compares the element on the index and if that element is greater than i+1th element, it just swaps the element. The worst and average case time complexity of Bubble sort is O(n^2). Let’s see Read more…

Insert math as
$${}$$