Binary Tree to Doubly LinkedList Conversion [ Microsoft – Amazon ]

Problem:Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL) In-Place. The left and right pointers in nodes are to be used as previous and next pointers respectively in converted DLL.The order of nodes in DLL must be same as Inorder of the given Binary Tree. The first node of  Inorder traversal (left

Jumping Numbers [ Google – Microsoft – Amazon ]

Problem:Given a positive number x, print all Jumping Numbers smaller than or equal to x. A number is called as a Jumping Number if all adjacent digits in it differ by 1. The difference between ‘9’ and ‘0’ is not considered as 1. All single digit numbers are considered as Jumping Numbers. For example 7, 8987 and

Edit Distance of Two Given String [ Amazon ]

Problem:Given two strings str1 and str2 and below operations that can performed on str1. Find minimum number of edits (operations) required to convert ‘str1′ into ‘str2′. a.Insert b.Remove c.Replace All of the above operations are of cost=1.Both the strings are of lowercase. Hint: Use DP to solve the problem. This problema also can be solved using

Find K-Palindrome of a string [ Amazon]

Problem:A string is k pallindrome if it can be transformed into a palindrome on removing at most k characters from it. Link


Kadane’s Algorithm [ Macrosoft – Amazon – FlipKart ]

Problem: Given an array containing both negative and positive integers. Find the contiguous sub-array with maximum sum. Link


Maximum Product Sub array [ Microsoft – Amazon ]

Problem : Given an array that contains both positive and negative integers, find the product of the maximum product subarray. Link Discussion: It is a Similiar problem to maximum sum sub array problem. Notice,maximum product can also be obtained by minimum (negative) product ending with the last element multiplied by this element. we use mn_end_here(can be

Search in rotational sorted array[ Microsoft – Amazon – FlipKart ]

Problem: Find a value from a rotational sorted array. Solution Hint: binary search. Link


Traverse 4×4 matrix spirally.[ Microsoft – BrowserStack ]

Problem:Traverse 4×4 matrix spirally. Link


Merge two Sorted (non-increasing) Array.[ Microsoft – quikr – LinkedIn – Snapdeal ]

Problem:Merge two Sorted (non-increasing) Array. Link


Find Excel Column Name From Column Number [ Microsoft, Amazon, Samsung ]

Problem:Given a positive integer, return its corresponding column title as appear in an Excel sheet. MS Excel columns has a pattern like A, B, C, … ,Z, AA, AB, AC,…. ,AZ, BA, BB, … ZZ, AAA, AAB ….. etc. In other words, column 1 is named as “A”, column 2 as “B”, column 27 as