I am trying to solve this using dynamic programming with complexity of O ( N ^ 2 ) which will give TLE because N <= 10 ^ 5.
How to solve Chef and Way using Dynamic Programming?
I am trying to solve this using dynamic programming with complexity of O ( N ^ 2 ) which will give TLE because N <= 10 ^ 5.