Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

assuming that the function is correct, store the number as byte array, where each memory location is 1 byte for 1 number location.

- Amit September 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Store the variable as double! The value of 100!= 9.33262154 × 10^157, which is less than the max value(1.79769 × 10^308) representable by a double.

- aiyemem March 14, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

You need to define your own data type for large numbers. Something like BigInteger type in Java. 100! has upto 150 digits. So an array of size 200 is enough to store the result. So store one decimal digit per array index. However you need to write your multiplication algorithm for multiplying two large numbers.

- Erik September 22, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For efficiency, You can divide 100 into groups of 10 and multiply them and store these 10 numbers in 10 arrays and you can use your multiplication algorithm for multiplying these 10 big numbers.

- Erik September 22, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int sum=0;
for(int i = 1;i<=N;i++)
{
sum = sum+log(i);
}
return 10^sum;

- Gajanan November 15, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Nice one :)
10^sum will still have the same overflow issues right?

- Rbn November 19, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Good job Gajju.
I didn't know it works this way as well.
But i think the question asker's problem is abt storage of large number(s).
Anyways, thanks Gajju.

- Abbujaan December 23, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Fuck Amazon

- ass March 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I guess you feel rejected due to your past failures in cracking interviews.
It would be wiser to prepare harder with help of careercup, rather than abusing companies.

- anony July 14, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Make 2 arrays , array1 is initialized to 100 ie each digit of 100 is stored in different locations of array1.
Array2 in initialized to 99 ie each digit of 99 is stored in different location of array2
now multiply each digit of array1 with each digit of array2. This multiplication is identical to the multiplication that we were taught in school. Time complexity of this type of multiplication is O(n2)

- abhimanipal April 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

hey you motherfucker stop asking your homework shit!

- Anonymous October 08, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

lol

- Anonymous October 13, 2009 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More