Блог пользователя Vrutik_2809

Автор Vrutik_2809, история, 4 года назад, По-английски

I was solving this problem. Although my solution is correct, i got TLE due to Java. My solution can be found here. But when i submitted the same solution in C++, it got accepted.

Can someone please help me out with how i can improve printing time in Java?

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

you can use StringBuilder like this

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Thanks for the help. So, in general, we should prefer default printing, and if we face this type of problem, we can try this approach. Is there any way to figure out priorly which method we should prefer? Because this is the first time I have encountered this type of problem

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

You can use PrintWriter