Practice Russian Doll Envelopes
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and the height of an envelope. One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's width and height. Return the maximum number of envelopes you can Russian doll (i.e., put one inside the other). Note: You cannot rotate an envelope.
Source: Russian Doll Envelopes on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
envelopes = [[5,4],[6,4],[6,7],[2,3]]
3
# Example 2
envelopes = [[1,1],[1,1],[1,1]]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Russian Doll Envelopes.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.