Sir, I tried my best to solve the problem but its giving time limit exceed with dp solution. I tried to do it with nlogn method of finding lis, but its not giving correct output. Please rectify where am I making mistake.
DP code :-
NlogN code :-
LIS Modified! problem doubt
dp sol take (n^2) time so it wont work here…see my code for nlogn once and try once again. Try to figure out where you are going wrong… I have used upper_bound here…
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.