karishma_gupta's blog

By karishma_gupta, history, 6 weeks ago, In English

https://codeforces.com/contest/448/submission/96518240 I think the complexity is O(n^2) and so, I can't figure out as to why does it TLE? I have been trying to debug it and optimize it for hours. Any help would be appreciated.

 
 
 
 
  • Vote: I like it
  • -12
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

After seeing the title I thought, you are gonna help me with this problem..

»
6 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

In case of increasingly sorted input data your solution has O(2^n) time complexity.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks a lot! I think I need to study complexity analysis for recursion.