// Write your code here
let x1Position = x1
let x2Position = x2
const x1BiggerAndFaster = x1 >= x2 && v1 >= v2
const x2BiggerAndFaster = x2 >= x1 && v2 >= v1
do {
const positionMatch = x1Position === x2Position;
if (positionMatch) {
return 'YES';
}
const x1PositionPassedx2Positon = (x1 >= x2) && (x1Position < x2Position)
const x2PositionPassedx1Positon = (x2 >= x1) && (x2Position < x1Position)
const cannotMatch = x1BiggerAndFaster || x2BiggerAndFaster || x1PositionPassedx2Positon || x2PositionPassedx1Positon
if (cannotMatch) {
return 'NO';
}
x1Position += v1
x2Position += v2
} while (true)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter