Pretty Graph
CodeChefOpen on judge ↗
Chef was recently given an array $A$ (size $N$) with distinct elements, he really loves graphs, so he decided to build a graph with $N$ nodes out of the array as follows - For each $i$, $j$, nodes $i$ and $j$ are connected if $i$< $j$ and $A_i \ge A_j$ He noticed that the resulting graph was very complicated and not pretty, so he decided to remove some of the vertices from the graph. If a vertex
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start