K - Ordered LCS

Can you please explain how to approach this problem, also with a sample test case…

You are given two arrays and you have to find k-ordered LCS which means that you can change at most k elements and you have to find the LCS then. So you can simply approach this problem by finding length of normal LCS of the two arrays first. Then add k to it. Finally display the value obtained.

https://ide.codingblocks.com/s/325778 why is it failing a few test cases?


Here is your corrected code. I have added comments. Please check it.