is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
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.
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.
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.
Considering four scenarios
- mail.shinev January 18, 20161 ) S and M if two locations are same, then no need of moving
2 ) S and M either the x value is same for both or y value is same for both
then there is only one move needed ( it is a parallel or perpendicular points )
3 ) S and M is in perfect diagonal
then absolute value of S.x-M.x will be equal to S.y-M.y
Eg (1,7) and (6,2) is a perfect diagonal
4 ) rest all is 2 move - a diagonal move then a straight move, or vice versa
public int move(Point S, Point M) {
if (S.x == M.x && S.y == M.y) {
System.out.println("both are same point");
return 0;
} else if (S.x == M.x || S.y == M.y) {
System.out.println("it is a parallel or perpendicular points");
return 1;
} else if (Math.abs(S.x - M.x) == Math.abs(S.y - M.y)) {
System.out.println("it is in diagonal , return 1");
return 1;
} else
return 2;
}