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: Ended!

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

No entries submitted for the current language.

Current Ranking

Python
#1 Kylljoy 94 bytes
#2 fwip 94 bytes
#3 Hydrogen 95 bytes
#4 evergreen 100 bytes
#5 Blake 108 bytes