0

As I am trying to take input using BufferReader and due to TLE exception i am trying to avoid scanner. I created a program and it was running successfully go to link if you want to see full program and Explanation and Clarification of program and question https://github.com/tirathsharma098/MonkAndRotation.
As I said program in the link was running successfully but it shows TLE exception therefore to avoid that exception, to make code more efficient and fast execution I was avoiding to use nested loops. Therefore, I was trying to store and parse array numbers directly.
Please don't refer me to any TLE page as I know TLE exception vary well.
May you want to know, my program is successfully running for 4 inputs out of 6. In 2 inputs program is taking 2.15 sec but it has to execute with in 1 sec. Also you may want to see input by online judge is https://he-s3.s3.ap-southeast-1.amazonaws.com/media/hackathon/codemonk-arrays-strings-2/problems/f9e21096b15c11ea.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=13e05c9730bef782b8d177571019f4100492ba4377b23ecc76d65debb46f4bbd&X-Amz-Date=20210329T062302Z&X-Amz-Credential=AKIA6I2ISGOYH7WWS3G5%2F20210329%2Fap-southeast-1%2Fs3%2Faws4_request.
Thanks.

    tempString = reader.readLine();
    tempArray = tempString.split(" ");
    arrayList.get(i).add(Integer.parseInt(tempArray));

0 Answers0