Microsoft Interview Question for Software Engineer / Developers






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

conditions for checking the rectangle overlap :


Cond1. If A's left edge is to the right of the B's right edge,
- then A is Totally to right Of B
Cond2. If A's right edge is to the left of the B's left edge,
- then A is Totally to left Of B
Cond3. If A's top edge is below B's bottom edge,
- then A is Totally below B
Cond4. If A's bottom edge is above B's top edge,
- then A is Totally above B

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

If the two rectangles are parameterized by the the top left corner and right bottom corner co-ordinates (with 1 pixel as 1 unit) like
1. For Rectangle R1 (r1x1, r1y1) and (r1x2, r1y2) are the respective top left corner and right bottom corner co-ordinates and
2. For Rectangle R2 (r2x1, r2y1) and (r2x2, r2y2) are the respective top left corner and right bottom corner co-ordinates then
the rectangles overlap if the following conditions are satisfied:
((r1x1 > r2x1) && (r1y1 > r2y1) && (r1x1 < r2x2) && (r1y1 < r2y2))
If the above condition is not satisfied, then the rectangles don't overlap

- UB_Green January 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

So, what is the question? two pixels overlapping or two rectangles?

Can two pixels overlap?

- Anonymous January 12, 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