• + 0 comments

    function kangaroo(x1, v1, x2, v2) { // Write your code here

    // Debug
    // 2081 8403 9107 8400
    
    let answer = "";
    let count = 0;
    
    let number  = (x1 + v1 + x2 + v2) * 10
    
    for( let i = 0; i <= number; i++){
    
      count += x1 + (i * v1) ===  x2 + (i * v2) ? 1 : 0;
    
    
    }
    
    answer = count > 0 ? "YES" : "NO"
    
    
    return answer
    

    }