← All problemsSign in

Equal LIS

CodeChefRating 1848Open on judge ↗

For a permutation $P$ of length $N$, we define $L(P)$ to be the length of the longest increasing subsequence in $P$. That is, $L(P)$ is the largest integer $K$ such that there exist indices $i_1 \lt i_2 \lt \ldots \lt i_K$ such that $P_{i_1} \lt P_{i_2} \lt \ldots \lt P_{i_K}$. Define $P^R$ to be the permutation $(P_N, P_{N-1}, \ldots, P_1)$. You are given a positive integer $N$. You need to o

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start