Ad
  • Default User Avatar

    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

  • Default User Avatar

    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.

  • Default User Avatar

    Hi devagx,

    How did you resolve the issue?

  • Default User Avatar

    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.

  • Default User Avatar

    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?