AbhishekAg's blog

By AbhishekAg, history, 4 years ago, In English

Getting TLE on test case 8 for this problem. I read the editorial which had O(n) complexity. My soln has a complexity of O(n *log n) but as n has an upper bound of 2e5 it should pass right (if it is correct)?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +10 Vote: I do not like it

The link isn't working

»
4 years ago, # |
  Vote: I like it +26 Vote: I do not like it

This "cur=cur+t[nc];" works for O(|cur|) Change it to "cur+=t[nc];".

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I would have never found it.......Never thought about it in terms of complexity before this....Thanks

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by AbhishekAg (previous revision, new revision, compare).