Monday, December 3, 2012

Given an NxN matrix with unique integers : Find and print positions of all numbers such that it is the biggest in its row and also the smallest in its collumn .


Example

1 2 3
4 5 6
7 8 9


#A reader posted as comment .

Determine whether a number is colorful or not. 263 is a colorful number because (2,6,3,2x6,6x3,2x3x6) are all different whereas 236 is not because (2,3,6,2x3,3x6,2x3x6) have 6 twice. So take all consecutive subsets of digits, take their product and ensure all the products are different

#A reader posted in Comment

Given an array of strings ... find the string which is composed of other strings in the array and is of maximum size. Ex: ["satcatratbat" , "rat", "bat", "cat", "sat", "ratbat", "ratsatcat"]. Output: "satcatratbat"

Source: http://www.quora.com/Shashank-Mani-Narayan/Cracking-The-Code/String-matching-porblem

Saturday, October 27, 2012

Given 2 arrays A,B, where x(A.length) < y(B.length), we want to insert (y - x) 0's to A at various places such that A*B is minimum. For instance, if A = (1, -1) and B = (1,2, 3, 4), then inserting two 0's in the middle of A such that A = (1, 0, 0, -1) would minimize


assume that dictionary has only 5 words... APPLE,APE,BABY,BALL,CAT write a program which will accept a string and list all possible words in the dictionary which start with that string.


Say you have an HTML file which contains more than 100,000 characters. How do you extract all the Phone Numbers from it


Given a website you have to find number of hits in the last second, last minute and last hour.


Given a signature, compute the lexicographically smallest permutation of [1,2,....n].


You are given an array of n elements [1,2,....n]. For example {3,2,1,6,7,4,5}.
Now we create a signature of this array by comparing every consecutive pir of elements. If they increase, write I else write D. For example for the above array, the signature would be "DDIIDI". The signature thus has a length of N-1. Now the question is given a signature, compute the lexicographically smallest permutation of [1,2,....n]. Write the below function in language of your choice.   vector* FindPermute(const string& signature);
This is another good one from google easy though :)