I was solving the question https://www.hackerearth.com/problem/algorithm/mancunian-and-k-ordered-lcs-e6a4b8c6/ and was following a tutorial video where they used 3d DP approach. But the code is giving TLE in java. Here’s the code
https://ide.geeksforgeeks.org/lsApEYPYgI
Can someone help resolve the issue?