sir there is something wrong in this question as i have opened the test cases and 1. first of all k numbers are not in increasing order as mentioned in the question 2. also in first test case there is a case of 40 4 78 63 19 46 how come it can have answer 0 as out of 80 only 4 positions are initialized answer should be atleast 1 please look into the matter and by the time provide some other link where i can submit this question
Square brackets
I am sure you would like to go through the actual problem statement here
Its a DP problem, apply recursion+memorization.
You can have a look at the editorial and other submissions and discussion easily.