can you please help me optimizing this code.
It gives TLE for first 4 test cases.
Thanks.
LIS Modified - 4 test case giving TLE
If you see the constraints of LIS modified problem , you can see O(n^2) will not work.
Hint- Segment Tree or Fenwick Tree to reduce complexity
1 Like
yes, I saw the constraints… sorry, I just skipped those topics and jumped to DP.
thanks