Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This is a new kind of task - you need to optimize server side code ^_^
You need to optimize your code
I have tried the logic for this on my local machine using an online java compiler - https://www.jdoodle.com/online-java-compiler/
for the 1000000th skip test case and i can see the ouput in 9.94 seconds but when i ran the same code/logic into codewars it gives me timeout.Not sure what is happening here.The output is as below on https://www.jdoodle.com/online-java-compiler/
15485867
15485917
15485927
15485933
15485941
15485959
15485989
15485993
15486013
15486041
Hi Chrono,
You were right.That was the input of several tests.So i tried to segregate it and it was as below:
call
1,2,3,4,3,2,1,
call
1,100,50,-51,1,1,
call
1,2,3,4,5,6,
call
20,10,30,10,10,15,35,
call
-8505,-5130,1926,-9026,
call
2824,1774,-1490,-9084,-9696,23094,
call
4,5,6,7,8,9,10,9,8,7,6,5,4,
call
8,8,
Now,when i have taken each and every input and ran the code on my local machine,it gave me the right result for every individual test whereas when i run the code in codewars,it says expecting -1 but found 1 after the above mentioned lines.
Hi devagx,
How did you resolve the issue?
Just see the sample tests. devagx below asked the same.
Hi Chrono79,
Thanks for your reply.First i also thought the same but i have written System.out.println() at the start of the function in loop.So this will be the single input.
That's not the input of a single test, that's the input of several tests one after the other, add a new line after printing the input.
For the below test input in Attempt,test is failing for me but when i run the same in my local machine it returns the true answer -1.
[1,2,3,4,3,2,1,1,100,50,-51,1,1,1,2,3,4,5,6,20,10,30,10,10,15,35,-8505,-5130,1926,-9026,2824,1774,-1490,-9084,-9696,23094,4,5,6,7,8,9,10,9,8,7,6,5,4,8,8,8,0,0,8]
Anyone has any idea why this is happening?