## Amazon Interview Question for Software Engineer / Developers

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

both are same

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

x^log n base x = x
so here 2nd expression = n^2

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

is this question given inside an onsite interview? i'm just wondering how it can be read through telephone....

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

say p = logq base 2
2^p = q
similarly
4^log n base 2 = 2^ (2 x log n base 2) = 2^ (log n^2 base 2) = n^2

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

Is this question asked in USA or India?

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

I think both are same.

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

they are the same. it doesn't matter what individual cases evaluate to, what matters is what they converge to.

by the way, the expression above is wrong: x^log n base x = x
It should be x^log n base x = n

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

x=4^(log n base 2)
x=2^(2log n base 2)
x=2^(log (n^2) base 2)
x=(n ^ 2) ; correlate to e ^ ( ln x) is x

Hence both are same.

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

Notion: log means log to the base of 2

n^2 = 4^(logn)

Prove:

put log to two sides of equation

log(n^2) = 2 * log(n)

log(4^(logn)) = log(n) * log4 = log(n) * 2

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

I dont think that o(n^2) is equal to another o(n^2) point being n^2 and 500n^2 + 500n + 500 both are n^2 but you know what grows faster.

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

Yes, By definition 1 = O(n^2) and n = O(n^2), so it could be anything.

btw, Anonymous, , there is a difference between O (Big-Oh) and o (Small-Oh).

Comment hidden because of low score. Click to expand.
-1
of 1 vote

O(n^2) grows faster

Comment hidden because of low score. Click to expand.
-1
of 1 vote

both are same. Put some value for n - say 16

O(4^2) = O(16)
O(4^log4 base 2) = O(4^2) = O(16)

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

I meant - say n=4

Comment hidden because of low score. Click to expand.
-1
of 1 vote

I don't think so.
For n = 5, n^2 = 25
where as 4 ^ (log 5 base 2) < 25.

So, O(n^2) grows faster.

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