Monthly Archives: February 2013

Add reg. integer and arbitary long integer

Posted in Google, Uncategorized | Leave a comment

Convert a BST to a sorted circular doubly linked list

Question:Convert a BST to a sorted circular doubly linked list in-place. Solution: Courtesy : The Great Tree-List Recursion Problem

Posted in Amazon, Microsoft, Trees | Leave a comment

Matching Nuts And Bolts

Question: You are given a collection of nuts of different size and corresponding bolts. You can choose any nut & any bolt together, from which you can determine whether the nut is larger than bolt, smaller than bolt or matches … Continue reading

Posted in Divide and Conquer, Microsoft, puzzles | Leave a comment

coins change

Question: Given 5 paise, 10 paise and 25 paise coins..list down all the possible set of coins change for 1 Rupee 5P coins 10P coins 25P coins ——————————– 20 0 0 18 1 0 16 2 0 15 0 1 … Continue reading

Posted in Dynamic Programming, Microsoft | 1 Comment

Binary Search Tree Check

Question: Given a binary tree, check whether it is a binary search tree or not. Solution 1: Solution 2: Efficient one

Posted in Amazon, Microsoft, Trees | 1 Comment

All Permutations of String

Question: Generate all permutations of a given string. Solution:

Posted in Amazon, Microsoft, recursion | Leave a comment

Reverse order of words in a sentence

Question: Given an input string, reverse all the words. To clarify, input: “Interviews are awesome!” output: “awesome! are Interviews”. Consider all consecutive non-whitespace characters as individual words. If there are multiple spaces between words reduce them to a single white … Continue reading

Posted in Amazon, Arrays, Microsoft | Leave a comment

Check balanced parentheses

Question: Given a string which contains alpha numeric characters with opening and closing parentheses, check whether parenthesis are balanced correctly. Solution:

Posted in Amazon, Arrays | 1 Comment

First non repeated character in string

Question: Find the first non-repeated (unique) character in a given string. Solution: Let’s use the hashtable to store the number occurrences of each character in the given string scanning from left to right. Then perform a second pass and check … Continue reading

Posted in Arrays | Leave a comment

Anagram Strings

Question: Given two strings, check if they’re anagrams or not. Two strings are anagrams if they are written using the same exact letters, ignoring space, punctuation and capitalization. Each letter should have the same count in both strings. For example, … Continue reading

Posted in Arrays, Microsoft | Leave a comment