Search
⌘K

Leetcode 3453. Separate Squares I

Given axis-aligned squares (xi, yi, li) whose overlaps count multiply, find the smallest horizontal line y such that the sum of areas of all squares above y equals the sum below. The core approach is to exploit that the area difference is monotonic in y and binary-search the y-coordinate, computing each square's above/below contribution by its vertical overlap.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid January, 2025

Google

Google

Mid-level

Given a list of points representing cakes on a table, where each point is [x, y, l] (x and y are coordinates, l is length and height of the cake), find a horizontal line such that the line divides the cakes into equal portions above and below it

Comments

Your account is free and you can post anonymously if you choose.