Unpleasant One: TLE

Why am I getting Time Limit Exceed?
Unpleasant One

would’ve been great if you attached the solution.
my guess would be the language you’re using is consuming more time.

I have. Check the link. I am using Java

the link take us to submission page not to your solution . Go to my submissions of that question and click on whichever solution you want to share and copy link and paste it here .

Here is you solution :- [ Solution: 48359941 | CodeChef]

I am a c++ user so I don’t have much idea about this but on some googling I found this .
[How to get rid of Java TLE problem - GeeksforGeeks]

1 Like

Thank you.
Question: Unpleasant One
Solution: https://www.codechef.com/viewsolution/48361052

@gautam3333 Rather than printing the arr element one by one use a StringBuilder to form the answer and print it at the end as I did : Modified Code