[1,3] -> [3,5] -> [8,4] -> [9,5]
Don't tell me that you can't rotate the envelope...coz that is silly.
However, if the rotation is allowed, the O(n) algorithm will not work. You have to solve the longest path in the DAG.
The question should clearly say the rotation is not allowed.
Both the width and height of one envelope is greater than the width and height of the other envelope. I think it is clear enough.
how can you explain [3,5] -> [8,4], the shorter got the big fat belly, can't fit into skinny girth... 5>4,
P.S It's fun to discuss this thou!
how can you explain [3,5] -> [8,4], the shorter got the big fat belly,
[3,5] = [5,3]
so ,[5,3] smaller than [8,4]
in real world one can rotate an object such as an envelope.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.