Back

PicScout is Hiring !!!

November 3, 2024
Hi all,
PicScout is looking for top notch SW engineers that would like to join an extremely innovative team.
If you consider yourself as one that can fit the team, please solve the below quiz and if your solution was well written – expect a phone call from us. You can choose any language you like or even write pseudo. In your code, include the relevant unit tests that will verify the correctness of the solution.

Answers can be sent to: omer.schliefer@picscout.com

Don’t forget to also attach your CV along with the solution.
Candidates that will finally be hired will win a 3K NISprize.

So here it is:

We want to write a program that will check for intersection between two rectangles.
The program will receive a string parameter which will represent two rectangles on a Cartesian coordinate plane and will contain 8 integer coordinates with the first 4 making up the first rectangle and the last 4 making up the second rectangle. The input string will be in the following format: “(0,0),(2,2),(2,0),(0,2),(1,0),(1,2),(6,0),(6,2)”

The program should determine the area of the space where the two rectangles overlap, and then output that area. . If there’s no overlap between the two rectangles return 0. 
For the above example, the program should output: 2
*The problem is taken from:
 http://coderbyte.com/CodingArea/Language.php?ct=Overlapping%20Rectangles

Add a new Comment

Your email address will not be published. Required fields are marked *