Technical Interview Question #8

Technical Interview Series

Create a structure which is used to hold the coordinates of a rectangle within an two dimensional coordinate system.

Now, add the code necessary to support the following:

  1. An arbitrary number of rectangles (think “windows”)
  2. Rectangles that are layered and overlap (and of course various sizes)
  3. Determine the window/rectangle in which a point is contained (factor in layering)

Are there any optimizations?

How would you handle non-rectangular windows efficiently?

One Comment

Comments are closed.