whizz.comp
BAN USER- -1of 1 vote
AnswersGiven a number (lets say 10 digit) - print all possible words that can be made from a phone pad. Remember that number n can vary. Also some numbers like 2 have ABC (only three alphabets) while 7 can have (PQRS) 4 alphabets. Your algorithm should acommodate all these.
- whizz.comp in United States
(Kids do the above part - it is a classic programming interviews exposed question).
I used recursion to start with.
Space complexity is O(1) (not considering stack) - as we are just printing.
Worst case time complexity is (4^n). - all numbers are 7.
The trick question was - how much STACK space will recursive prog require? -- I bombed this trick ques. and got a reject.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm
- 4 Answers Amazon on-site interview reject.
I interviewed with Amazon and had an on-site interview in Seattle. I was rejected and they did not move forward. The HR told me that keep applying and he forwarded my resume to the recruiter. They said you won't have to wait for interviewing with other teams - so please don't write-off Amazon from your list and keep looking.
- whizz.comp April 14, 2012
Doesn't Amazon have a policy period where you have to wait for certain months to re-interview?
(On a side note: I really made some silly mistakes and wasn't careful of edge cases - so I wasn't terribly surprised that I didn't clear it. But I have learnt from my experience and I can be better prepared ahead in future)| Flag | PURGE
Mediator design pattern
- whizz.comp March 25, 2012If you are talking about how will you represent this in OO-world, then the answer is using Composition design pattern which is structural.
- whizz.comp March 25, 2012@Mohit - It is one of the CC questions - the must have book.
1. Sorting - O(nlogn)
2. Min Heap - O(nlogm) n = billion, m = million
3. RAND-QUICK-SELECT(array, rank) - this modifies the array. - Amortized time O(n) - linear.
You should mention to the customer that in the background the IDE continually tries to build/compile. This code runs in a separate thread. While auto complete may be well described using a TRIE, the trie is built over and over again as part of compilation in the background thread. The suggestion for properties and methods is implemented using REFLECTIONS (in C# or java).
- whizz.comp March 03, 2012This is a kth order statistics problem can be solved in O(n).
Rand-Select() algorithm works too.
There is a rather special case (since its just second largest) - brute force as below.
namespace QuickPorjects
{
class Program
{
static void Main(string[] args)
{
int[] arr = new int[] { 7,1,2,3,4,5,8 };
FindTwoLargest(arr);
}
private static void FindTwoLargest(int[] arr)
{
int max = int.MinValue;
int max_second = int.MinValue;
int i;
//max = arr[0];
for (i = 0; i < arr.Length; i++)
{
if (arr[i] > max)
{
max_second = max;
max = arr[i];
}
else if (arr[i] > max_second)
{
max_second = arr[i];
}
}
Console.WriteLine(max + " " + max_second);
}
}
}
sorting is at least O(nlogn)......... unless you are using linear sort which are inefficient
- whizz.comp March 02, 2012The abstract class is desgined in a way that developers can use/inherit the basic functionality of the class, but doesn't forget to implement their additional logic. Some function may or may not be overridden depending on the need.
- whizz.comp March 02, 2012
Repmarktrejjo, Data Engineer at Accolite software
I’m Mark.I believe life is too short to be serious all the time, so if you cannot laugh ...
Repmelonydmaxwell, maintenence engineer at AMD
Hi, I am working as a health information technician and my work is to collect and maintain a patient's ...
Repgarycsroka, Backend Developer at Axiom Sources
Hi I’m Gary, an average 19 year old in a state college who sees life as an adventure.Provide ...
This is the C# code - this should work just fine
TESTED with
a0b1c1
a100b44c22
a2b3c4
(Only thing left in the code is to check the length of input and output and make decision accordingly)
- whizz.comp March 06, 2013