Amazon Interview Question for Software Engineer / Developers


Country: India
Interview Type: Phone Interview




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

Look up ugly numbers/hamming numbers on the web.

- Anonymous September 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Maintain variables 'count' initialized with 0 and 'num' initialized with 1. Check if num%2 or num%3 or num%5 equals 0. If yes, increment count and then check if count equals K. If yes return num else increment num.

- Neeraj September 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

But, here we will get those numbers also which have factors one or more of these numbers and some other prime factor as well. For example, one getting 42 your algo will increment count, which it should not since it is having 7 also as a factor.

- vineetchirania September 08, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

if i am not wrong..it seems very straight forward
multiply all 3 prime numbers. and the multiply the result with k. That should be our result.

- Anonymous September 14, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

You couldn't be more wrong here..kth number or for that matter any number in the series here will only have the 3 prime nos as their factor and no other number could be its factor. If you multiply it by k then k becomes a factor of that number which makes it wrong.

- vineetchirania September 14, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I am not telling he is right.. but you explanation is also wrong... in the given example 4 and 8 both is the part of array and 4 is factor of 8..

2 way I can explain..
go through number by number...
check num%p1==0 or num%p2==0 or num%p3==0
increase the counter upto k... our output is the last number...

2nd way is...
keep three variables associated with each prime number.. suppose i,j,k associated initialize with 1. 1 counter also
find min(p1*i,p2*j,p3*k)
increase the corresponding variable increase the counter by 1 until k. give the last number a output..

- sanjay.2812 September 21, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

<pre lang="" line="1" title="CodeMonkey99376" class="run-this">/* The class name doesn't have to be Main, as long as the class is not public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
String s;
while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
}
}

</pre><pre title="CodeMonkey99376" input="yes">
</pre>

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

<pre lang="" line="1" title="CodeMonkey29742" class="run-this">/* The class name doesn't have to be Main, as long as the class is not public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
while(true)
system.out.println("amazon is insane to ask such moronic questions"
}
}

</pre><pre title="CodeMonkey29742" input="yes">
</pre>

- Anonymous September 22, 2011 | Flag Reply


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