Search
⌘K

Leetcode 497. Random Point in Non-overlapping Rectangles

Given non-overlapping axis-aligned rectangles, pick a uniformly random integer point from their union by treating each rectangle's count of integer lattice points as its weight, sampling a rectangle with probability proportional to that count (via prefix sums and binary search), then uniformly selecting integer coordinates inside the chosen rectangle.


Question Timeline

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

Comments

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