Back to problems

Russian Doll Envelopes

Algorithm · Google · Medium

Requirements Input: an array of envelopes represented as (width, height) pairs. Output: the maximum-length sequence in which every envelope can be placed strictly inside the following one. Examples [[4,5],[5,6],[5,3],[6,7]] → 3. One valid nesting sequence is [4,5] → [5,6] → [6,7]; envelopes sharing width 5 cannot nest together.

Checking your access…