My issue
I’m getting the right answers, could you guys help me to see what is wrong?
My code
// your code goes here
process.stdin.resume()
process.stdin.setEncoding('utf-8')
let data=''
process.stdin.on('data',(input)=>{
data = input.split('\n')
})
process.stdin.on('end',()=>{
let i=0
const numberTest = data.shift()
let finalData = data.map((d)=> d.split(' '))
while(i<numberTest){
console.log(yearsToBecome(...finalData[i]) )
i++
}
})
function yearsToBecome(A,B,X){
return (B - A)/X
}
Learning course: Level up from 1* to 2*
Problem Link: CodeChef: Practical coding for everyone