Log In   Register

Code Golf: Rectangle Intersection

Started: 1575763200, F jS, Y g:i:s A
Ends: 1576368000, F jS, Y g:i:s A
Time Remaining:

Description

Given two rectangles, find the total amount of area that overlaps.

Rectangles will be provided as a tuple of 4 integers: (x, y, width, height)

Write a function called findarea that takes in two of these tuples as input.

>>> findarea((10205030), (301010100))
300
Since all inputs are integers, the result should also be an integer. All rectangles will have positive width and height.

Rectangles that do not overlap should return 0.

You must be logged in to submit an entry.

Submission Queue

 
 

Your best Python entry so far

Current Ranking