Russian Doll Envelopes
You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and height of an envelope. Return the maximum number of envelopes you can Russian doll (i.e., put one inside other).

30:00

Russian Doll Envelopes
hard
Topics
Companies

You are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and height of an envelope. Return the maximum number of envelopes you can Russian doll (i.e., put one inside other).

Example 1:
Input: {"envelopes":[[5,4],[6,4],[6,7],[2,3]]}
Output: 3
Constraints:
  • 1envelopes.length1051 \leq \text{envelopes.length} \leq 10^5

  • envelopes[i].length==2\text{envelopes}[i].\text{length} == 2

  • 1wi,hi1051 \leq w_i, h_i \leq 10^5

Input
arr ={"envelopes":[[5,4],[6,4],[6,7],[2,3]]}

Given 4 envelopes

Envelopes [width, height]

[5, 4]

w×h

[6, 4]

w×h

[6, 7]

w×h

[2, 3]

w×h
Total: 4
Variables
No variables to display
DepthFunction Call
Stack empty
0/6