Determine if N given rectangles are an exact cover of a rectangle
Given N rectangles with integer coordinates, check whether they are an exact cover of a rectangular region
If you don't know already, Google's on-site interview process involves 5 independent interviews in one day. In each one a Google Software Engineer poses a problem that should be solved in 45 min to 1 hr. The interviewee can code on a white board or in Google Docs (check with your recruiter for details) in a language of their choice, but not pseudo-code.
By itself, the question is not all that intimidating, but the time-limit can make it quite challenging. That's why I'm practising!
As usual, there is a fairly straightforward "brute force" solution, and some better solutions. I'll give hints and solutions immediately after the jump so avoid spoilers by not looking past the example inputs yet.
Read full article from Determine if N given rectangles are an exact cover of a rectangle
No comments:
Post a Comment