1

I need to find the maximal subset $S$ of an array $A$ of length $N$ ,where each element of $A$ contains $X$ and $Y$, such that for each $0 \leq i \lt N$ , $j \lt i$ the rule is $S[i].X \lt S[j].Y$ , What would be the best approach for finding such subset of $A$ (in terms of time, knowing that $N \leq 100,000$) ?

EDIT: An example to that is $A = \{(2, 15), (6, 3), (6, 11), (4, 7), (8, 5)\}$

$S$ can be $\{(6,11),(2,15),(4,7),(6,3)\}$ where each $X$ of $S$ is smaller than each $Y$ before it

mohammed essam
  • 231
  • 2
  • 8

0 Answers0