Amazon Interview Question for Software Engineer / Developers






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

One example: K = 8, then
8th power = 4th power X 4th power
= (2th power X 2th power) X (2th power X 2th power)
Therefore it is a binary
O((logK)*O(n^3))

- Anonymous March 14, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ain't it ceil(logK)*O(n^3) ?

- knap December 13, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can we assume the matrix is a square matrix?

- anon January 25, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

my bad, i just reread the question.

- anon January 25, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

If I remember my linear algebra correctly, it is possible to solve this problem in constant time relative to K, i.e. assuming that the matrix is squared and is invertible (or the determinant != 0)

- Anonymous April 28, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the basic idea is to make use of pre-calculated results. use dynamic programming. the solution by Anonymous is pretty clear and follows this idea.

- Anonymous August 31, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A is nxn .. order is (n^3log(m))
Matrix pow(Matrix& A, int m)
{
     if (m == 0) return I; // identity matrix
     if (m==1) return A;
     Matrix b = pow(A, m/2);
     if (m&1) return b*b*A;
     else return b*b;
}

- Anonymous July 28, 2013 | 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