Couple of years ago when me and my friends appeared for campus interviews in IITs, NITs and BITs we faced many challenging interview questions like N petrol bunks arranged in a city, Sort Stack … Read More
Microsoft Interview Questions
K’th Largest Element in BST when modification to BST is not allowed
Given a Binary Search Tree (BST) and a positive integer k, find the k’th largest element in the Binary Search Tree.
Daughter’s Age VeryGood Puzzle
Hello folks,Today I am posting an Interview Puzzle which was asked to my friend in his Interview. This puzzle will be helpful in job interview preparation.
… Read More I have also posted many puzzles for interview before,
Count Possible Decodings of a given Digit Sequence
Find number of ways a string can be decoded into, if A=1, B=2, C=3 … Z=25 and encoding number is 123 ways decoding can be done is
1 2 3 = A B C
1
… Read More 1 2 3 = A B C
1
Find the element that appears once others appears thrice
Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once.
Expected time complexity is O(n) and O(1) extra space.
Examples:
Input: arr[] =
… Read More Expected time complexity is O(n) and O(1) extra space.
Examples:
Input: arr[] =
Find if a binary tree is height balanced ?
A Height Balanced Tree is tree where for each node this condition is true.
– The difference between heights of left subtree and right subtree for any node is not more than 1.So we can
… Read More – The difference between heights of left subtree and right subtree for any node is not more than 1.So we can
Find the number ABCD such that when multipled by 4 gives DCBA.
We need to find a number ABCD such that, 4(ABCD) = DCBA
These problems can be tricky and/or tedious, but this one isn’t too bad.Method 1 ) Forming Equations and Solving them
… Read More These problems can be tricky and/or tedious, but this one isn’t too bad.Method 1 ) Forming Equations and Solving them
Word Break Problem
Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words. See following examples for more details.
This is a famous
… Read More This is a famous
Puzzle : 100 doors in a row Visit and Toggle the door. What state the door will be after nth pass ?
you have 100 doors in a row that are all initially closed. you make 100 passes by the doors starting with the first door every time. the first time through you visit every door and
… Read More Longest Increasing Subsequence
The longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order.For example, length of LIS
… Read More