Amazon Interview Question for Software Engineer in Tests






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

call isValidMove for all the below positions
(x-2,y-1);(x-1,y-2);(x-2,y+1);(x-1,y+2);(x+2,y-1);(x+1,y-2);(x+2,y+1);(x+1,y+2)
bool isValidMove(x,y){
  if(x>=0&&x<=7&&y>=0&&y<=7)
     return true
}
//assuming the coordinate system is between [0,7][0,7]

- Anonymous December 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Maybe you should also validate whether there is a piece(his own or opposite) at that position. If so, reture false.

- sen December 31, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

If the opponent's piece is present then it will be a valid move.

if it is same color piece, then u cn return false.

(what is while board ?)

- Rj January 02, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

if knight is securing king i.e knight is in between king and opponents power then you cant move knight... if you move the knight then king will be under check mate, so that move is invalid...

- nr January 06, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Thats a valid move...bugger want to loose :D

- Anonymous March 14, 2011 | 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