sonali.kapor007
BAN USER- 0of 0 votes
AnswersYou have two arrays A and B of strings. In the array B all element are from A except one. ex:
- sonali.kapor007 in India
A = {"abc", "bcd", "dpr"};
B = {"abc", "mnp", "bcd", "dpr"};
You have find out the string which is extra in B in O(n) time.
In the above example it is "mnp".| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answers
- sonali.kapor007 in IndiaGiven an array and a number K. You have to find out longest subset from the array whose all pair sum will be greater than k. ex: {8,3,4,1,6,2,5,7,9} and K=12 ans: {8,6,7,9} or {5,7,8,9}
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm
They asked for other approach than hashing. Suffix tree is one of the best way of string matching. With suffix tree we can get a O(n) solution. Can you think of any other way of doing it?
- sonali.kapor007 November 17, 2011No they are not sorted.
- sonali.kapor007 November 17, 2011yes I said that. But asked to solve it without hashing.
- sonali.kapor007 November 14, 2011Please let me know what extra information is needed. In the above example output = {8,6,7,9} because all pair in it, <8+6>, <7+8>, <8+9>, <6+7>, <6+9>, <7+9> greater than 12.
- sonali.kapor007 November 14, 2011
h<Tee><Tee>p://leetcode.com/2011/11/longest-palindromic-substring-part-i.html
- sonali.kapor007 March 25, 2012For O(N) time and O(N) space : Manacher’s Algorithm