Given a string you need to print longest possible substring that has exactly M unique characters. If there are more than one substring of longest… Read More

All Medium Articles

In a country, all families want a boy. They keep having babies till a boy is born. What is the expected ratio of boys and… Read More

There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then… Read More

I was recently interviewed for SDE-II in Flipkart. A lot of emphases was on designing and GeeksforGeeks has been a lot of help. These are… Read More

First of all, i got the mail and was asked to attend one online test. Online test had 6 parts-psychometric test, aptitude, logical, English, computer… Read More

Given two dates, find total number of days between them. The count of days must be calculated in O(1) time and O(1) auxiliary space. Examples: … Read More

Puzzle: Consider a two-player coin game where each Player A and Player B gets the turn one by one. There is a row of even… Read More

100 prisoners in jail are standing in a queue facing in one direction. Each prisoner is wearing a hat of color either black or red.… Read More

Given an integer n, calculate the square of a number without using *, / and pow(). Examples : Input: n = 5 Output: 25 Input:… Read More

Given a n by n board where n is of form 2k where k >= 1 (Basically n is a power of 2 with minimum… Read More

There are 25 horses among which you need to find out the fastest 3 horses. You can conduct race among at most 5 to find… Read More

Write a function “runCustomerSimulation” that takes following two inputs a) An integer ‘n’: total number of computers in a cafe and a string: b) A… Read More

Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You… Read More

A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’… Read More

In C, we can specify size (in bits) of structure and union members. The idea is to use memory efficiently when we know that the… Read More

Alok has three daughters. His friend Shyam wants to know the ages of his daughters. Alok gives him first hint. 1) The product of their… Read More

Given a rectangular matrix which has only two possible values ‘X’ and ‘O’. The values ‘X’ always appear in form of rectangular islands and these… Read More

Given an array of size n where all elements are distinct and in range from 0 to n-1, change contents of arr[] so that arr[i]… Read More

Hi everyone, Recently i had wonderful interview experience with Sap Labs India. I would like to share the interview experience with all the readers and… Read More

Recently Microsoft visited our campus for SDE intern. The process took over 4 months. Round 1 (Online MCQ’s) time- 30 minutes. This was conducted on… Read More