Count of n digit numbers whose sum of digits equals to given sum [ Amazon ]

Problem: Given two integers ‘n’ and ‘sum’, find count of all n digit numbers with sum of digits as ‘sum’. Leading 0’s are not counted as digits. Print your output % 10^9+7.

 

Word Break [ IBM – Google ]

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. Consider the following dictionary { i, like, sam, sung, samsung, mobile, ice,cream, icecream, man, go, mango} Input:  ilike Output: Yes The string can be

Almost Prime number

Problem:A no is said to be  k-Almost Prime Number if it  has exactly k prime factors (not necessary distinct). Your task is to complete the functionprintKAlmostPrimes which takes two argument k and N and prints the  first N numbers that are k prime. Problem Link

 

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