• + 0 comments
     public static int jump(int startPoint, int distance){
            return startPoint + distance;
        }
        public static String checkRes(int x1, int v1, int x2, int v2){            
            if ((x2 > x1 && v2 >= v1) || (x1 > x2 && v1 >= v2)) { 
                return "NO";
            }
            if ((v1>10000) || (v2>10000)){
                return "NO";
            }
            int res1 = jump(x1, v1);
            int res2 = jump(x2, v2);
            
            if(res1 == res2){
                return "YES";
            }else{
                return checkRes(res1, v1, res2, v2);
            }
        }
        public static String kangaroo(int x1, int v1, int x2, int v2) {
           return checkRes(x1, v1, x2, v2);
    
        }
    
    }