#3454

Separate Squares II

expert · 1205 · lc hard +32 · 59.9% accepted · 272 likes · top 58%

Description

Given axis-aligned squares described by squares[i] = [xi, yi, li] (bottom-left corner and side length), locate the smallest y-coordinate of a horizontal line that splits the total covered area evenly: equal coverage above and below.

An answer within 10-5 of the correct value is acceptable.

Note: In this version, overlapping regions are counted only once.

Code

1
2
3