What is tinyurl? A tinyurl service compresses a long url into a short one. This saves space, and is useful for scenarios such as twitter or weibo, where each character counts. The down side is possible spam use. Concerns include longevity of a short url. i.e. “http://tiny.me/5ie0V2″. The highlight part can be any string with … Read More →

## Construct Binary Tree from Postorder and Inorder Traversal

Given postorder and inorder traversal of a tree, construct the binary tree. Solution: The post order array contains the elements in the order of post order traversal of the binary tree and we know that the last element in the post order traversal is the root of the binary tree. We can then search the … Read More →

## Construct Tree from given Preorder and Inorder Traversals

Given preorder and inorder traversal of a tree, construct the binary tree. Solution: The pre order array contains the elements in the order of pre order traversal of the binary tree and we know that the first element in the pre order traversal is the root of the binary tree. We can then search the … Read More →

## Combination Sum Problem

Problem: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in the combination. Note: All numbers (including target) will be positive integers. Elements in a combination (a1, a2,…, ak) must … Read More →

## 100 Blue Eyes Puzzle

Puzzle: This puzzle is one of the hardest puzzle in the world. If you are able to solve this, believe me you are genius. A group of people with assorted eye colors live on an island. They are all perfect logicians — if a conclusion can be logically deduced, they will do it instantly. No … Read More →

## Flatten A Binary Tree to Linked List (In-place)

Problem: Given a binary tree, flatten it to a linked list in-place. For example, The flattened tree should look like: Solution: We can solve this problem recursively by doing a in-order traversal of the tree. Implementation:(Recursion) Non-Recursion, No Stack We can also solve the problem even without a stack: Each time when we prune a … Read More →

## Car Wheels Problem

Puzzle: A car has 4 tyres and 1 spare tyre. Each tyre can travel a maximum distance of 20000 kilometers before wearing off. What is the maximum distance the car can travel. You are allowed to change tyres (using the spare tyre) unlimited number of times. Note: All tyres are used upto their full strength. … Read More →

## Word Ladder Problem

Problem: Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: Only one letter can be changed at a time. Each intermediate word must exist in the dictionary For example, Given: start = “hit” end = “cog” dict = ["hot","dot","dog","lot","log"] As one shortest … Read More →

## How to Check if a given Number is Fibonacci number?

In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence: 1,1,2,3,5,8,13,21,34,55,89,144.. A simple way is to generate Fibonacci numbers until the generated number is greater than or equal to ‘x’. Following is an interesting property about Fibonacci numbers that can also be used to check if a given number … Read More →

## Product of All Other Array Numbers

Problem: Given an array of n integers where n>1, return an array of same size an input array where at every index of the output array should contain the product of all elements in the array except the element at the given index. Example: arr[] = {10, 4, 1, 6, 2} prod[] = {48,120,480,80,240} Solution: … Read More →

## Oxigen Wallet Interview Questions – Set 1

Round 1: Online coding test on Cocubes.com Round 2: Q1. Linked list multiplication: Given two linked list that represents polynomial return a pointer to linked list which is multiplication of the two. struct node { int coeff; int exp; struct node*next; }; example: 4x(2)-2x+1 x-1 answer : 4x(3)-6x(2)+3x-1 Q2. Suppose when user chooses OxygenWallet as … Read More →

## Flipkart Interview Questions – Set 6

I had interview with Flipkart for SDE . There was two technical round both guys was cool and interview process was very nice when i got stuck they provide me hint. Round 1: Q1. You have a infinite stream of repeated number find top K frequent number from this stream and discussion on this question … Read More →

## What’s going on ?