Longest Nesting Chain of Rectangles

Asked at Google · Coding Questions · Difficulty: Hard

You are given a list of rectangles, each described as `[width, height]`. Rectangle A fits inside rectangle B when `A.width < B.width` and `A.height < B.height`, both strictly. Rectangles cannot be rotated. Find the longest sequence of rectangles in which each one fits inside the next, and return its length.

Loading the problem…