A design system has card sizes sizes[i] = [width, height]. A card can be placed inside another card only if it is strictly narrower and strictly shorter. Cards can't be rotated.
Write deepestNesting(sizes) that returns the largest number of cards you can nest one inside another.
Input: sizes = [[4,3],[5,3],[5,8],[1,2]] Output: 3
[1, 2] inside [4, 3] inside [5, 8].
Input: sizes = [[2,2],[2,2]] Output: 1
Equal cards don't fit inside each other.
1 <= sizes.length <= 1000001 <= width, height <= 100000Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #526 Nest Modal Cards. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.