← All problemsSign in

Rank from the Last

You are given one permutation of Length $N$. You have to tell how many permutation is lexicography greater than given permutation. answer maybe large so print answer modulo $10^9+7$. a permutation $A$ is lexicography greater than $B$ if $A_1 = B_1, A_2=B_2,\dots ,A_i>B_i, \dots$ for some index $i$ of permutation. ###Input: - First line of input is number of testcase $t$ $(1 \le t \le

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