prakhar897's blog

By prakhar897, history, 6 years ago, In English

I was trying to solve this problem. Here my solution which got TLE. So i copied the exact author's solution in Java but it's still getting TLE. solution

Can anyone tell me whats happening here?

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

| Write comment?
»
6 years ago, # |
  Vote: I like it +1 Vote: I do not like it

It's all about Arrays.Sort(), use another method for that.

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

    Thank you for helping me. The code ran fine after i replaced it with Egor's method. I still didn't understand why Arrays.sort() was inefficient here given it is an inbuilt java method .