Lis modified doubt


first i used nlogn method and i am getting tle.

now my question is:

  1. is there any other method than bit or trees.
  2. if using bit what will be the time complexity

the code is empty, can you provide me the code, plus this problem is a standard 1D DP problem
just like the way LIS is done, just store the sum instead of the length


my code
i did the same what said but still tle


this is BIT based solution (will pass)

this is the basic approach(TLE although) be thorough with this approach since this is more commonly asked