Second LIS
Given a sequence of n numbers A[1..n], a length-k increasing subsequence (IS) is A[i1], A[i2], ..., A[ik] such that both the indices i and values are strictly increasing. Among all possible IS's, denote the maximum length as L. Now we are interested in finding how many length-(L-1) IS's are there. Two IS's are different if and only if their indices are different. Since the answer could be very l
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