Can’t i just add k to the longest lcs. I’ll just add the boundary condition for when it exceeds the size of the string. I tries this and it worked at hackerblocks as well as hackerearth. All test cases got accepted
Can't i just add k to the longest lcs
yes it seems plausible. However do you know what k elements you will add to the string ?
Also note here it is atmost k elements and not k elements
Well to get the longest sequence we could use as much of the k values as possible. If it exceeds, then i have added the edge case for that
call me on 7838702561
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.