I was attempting the CSES Apartments problem and here is my solution in java. I've used the two pointer approach but still I have a timeout in one of the testcases. Someone please help me understand the shortcoming in my code.
Thanks in advance.
I was attempting the CSES Apartments problem and here is my solution in java. I've used the two pointer approach but still I have a timeout in one of the testcases. Someone please help me understand the shortcoming in my code.
Thanks in advance.
We can't see that solution. If you go to the submission page, there is a blue button that says "Share code to others". If you hit that and copy the link, we can see the code.
I can. This is the submission:
Java is just slow, if you want AC use C++ but otherwise don't mind it since the CSES grader is naturally slow.
Have nobody taught you to not use
Arrays.sort()
? C'mon dude. UseCollections.sort()
instead.