Given a Binary Tree (Bt), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous… Read More

All Medium Articles

The cost of a stock on each day is given in an array, find the max profit that you can make by buying and… Read More

Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are outside the given range. The modified tree should also… Read More

Given n sets of integers of different sizes. Each set may contain duplicates also. How to find the intersection of all the sets. If an… Read More

Given an array of size n, the array contains numbers in range from 0 to k-1 where k is a positive integer and k <=… Read More

Standard C library provides qsort() that can be used for sorting an array. As the name suggests, the function uses QuickSort algorithm to sort the… Read More

Recently i was interviewed for Build Team Engg. role in Microsoft hyderabad. I was selected. I am really thankful to GeeksForGeeks site which gave me… Read More

Given a set of time intervals in any order, merge all overlapping intervals into one and output the result which should have only mutually exclusive… Read More

Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the… Read More

Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the… Read More

Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the… Read More

Given a 2D matrix, print all elements of the given matrix in diagonal order. For example, consider the following 5 X 4 input matrix. Example:… Read More

Consider the same code as given in above question. What does the function print() do in general? The function print() receives root of a Binary… Read More

Consider the following code snippet in C. The function print() receives root of a Binary Search Tree (BST) and a positive integer k as arguments.… Read More

Given an unsigned integer, swap all odd bits with even bits. For example, if the given number is 23 (00010111), it should be converted to… Read More

Output? #include <stdio.h> int main() { register int i = 10; int *ptr = &i; printf("%d", *ptr); return 0; } (A) Prints 10 on all… Read More

We have discussed Pancake Sorting in the previous post. Following is a problem based on Pancake Sorting. Given an unsorted array, sort the given array. You… Read More