Skip to content
All Medium Articles
In the previous post, we introduced union find algorithm and used it to detect cycle in a graph. We used following union() and find() operations… Read More
Given an array of words, print all anagrams together. For example, if the given array is {“cat”, “dog”, “tac”, “god”, “act”}, then output may be… Read More
Following is a C++ program that prints 1 to 100 without loop and without recursion. #include <iostream> using namespace std;    template<int N> class PrintOneToN… Read More
Given two numbers represented by two linked lists, write a function that returns the sum list. The sum list is linked list representation of the… Read More
I am Amit Dhaka. Following is my experience of MS IDC intern interview. Date of Written: 9th September, 2012. Date of Interview: 15 October, 2012.… Read More
Reservoir sampling is a family of randomized algorithms for randomly choosing k samples from a list of n items, where n is either a very… Read More
  Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains… Read More
Given a string, find the longest substring which is palindrome. For Example:   Input: Given string :"forgeeksskeegfor", Output: "geeksskeeg". Input: Given string :"Geeks", Output: "ee".   Recommended:… Read More
We have discussed assignment operator overloading for dynamically allocated resources here . This is a an extension of the previous post. In the previous post,… Read More
Given a string, find the longest substring which is palindrome.  For example,  Input: Given string :"forgeeksskeegfor", Output: "geeksskeeg" Input: Given string :"Geeks", Output: "ee" Recommended:… Read More
Following is a typical recursive implementation of Quick Sort that uses last element as pivot. C++ // CPP code for recursive function of Quicksort #include… Read More
Predict the output of following C++ programs. Question 1 #include <iostream> using namespace std;    class A {     public:     A& operator=(const A&a)     {         cout <<… Read More
Given an unsorted array of positive integers, find the number of triangles that can be formed with three different array elements as three sides of… Read More
Given preorder traversal of a binary search tree, construct the BST. For example, if the given traversal is {10, 5, 1, 7, 40, 50}, then… Read More
Given a string, find its rank among all its permutations sorted lexicographically. For example, rank of “abc” is 1, rank of “acb” is 2, and… Read More
Given an array of non-negative integers. Find the largest multiple of 3 that can be formed from array elements. For example, if the input array… Read More
Given a linked list where every node represents a linked list and contains two pointers of its type: (i) Pointer to next node in the… Read More
Given a binary matrix, print all unique rows of the given matrix.  Example:  Input: {0, 1, 0, 0, 1} {1, 0, 1, 1, 0} {0,… Read More
How to implement LRU caching scheme? What data structures should be used? We are given total possible page numbers that can be referred. We are also… Read More
Recently I attended Microsoft Campus Interview and got selected. Below is my Interview Experience and I just wanna share it to GeeksforGeeks viewers. 1st Round:… Read More