CARVANS - Issue with nodeJS submission

i submitted a code in php for carvan and it worked. Now trying to submit the code in nodeJS. But it is failing.Can someone look at the code .
This is the link for the code

http://www.codechef.com/viewsolution/1721159

in your moves() function, maybe you should try if ( parseInt(sal[j]) < parseInt(max) ), with strict comparison, instead of <=, because == would mean the car is able to go at its maximum speed. please tell us if it works. :slight_smile:

@mithunnmo: The problem with your nodejs submission is with the way you are reading from the standard input. You are expecting data event to be fired for each line. When the judge passes the input file as standard input the data event will be fired for the entire file content and not on a per line basis. Hence your code is unable to process the input. You can view other nodejs solutions here for reference. Hope this clears your doubt.

I did make the change . It didn’t work . But i had used the same logic in php and it had worked . I am guessing its some input output issue .Since i am getting the correct answer .
CAn you please check with the admin . Here is the updated code.
http://www.codechef.com/viewsolution/1722934

can the admin comment on this please ? I am getting the right answer and i suspect this a problem with nodejs input/output.

where is your submission with : starting count = 0, j going from 0, and the strict comparison ?

i tried with count = 0 and j = 0 . But it gives me wrong answer in my dev environment. But if I give me count =1 and j= 0, strict comparison .
Then it gives me correct answer in dev environment. But here in the codechef platform it always gives me wrong answer.