My code
Link to my solution.
Please help!
Thanks in advance
Heyy I can give the code in C++…If u r able to undestand bcoz i didn’t code in java
Yes please!
I got the same error. It’s because “Scanner” class is rather slow to take input so use Fast IO (Buffered reader). Check this link out Fast I/O in Java in Competitive Programming - GeeksforGeeks
1 Like
Heyy ,it is showing TLE bcoz scanner class has slow input/output and for the large input it was showing tle to you. You can read some gfg article for fast input/output in java
Or you can check out my solution
1 Like
Thanks a lot!
Thanks a bunch
Got it! Thanks