Created
March 10, 2019 12:27
-
-
Save pbrewczynski/a7e47e8e703e02f8d08e169814d32045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Complete the kangaroo function below. | |
func kangaroo(x1: Int, v1: Int, x2: Int, v2: Int) -> String { | |
if v2 >= v1 { | |
return "NO" | |
} | |
let speedDifference = v1 - v2 | |
let initialPositionDifference = x2 - x1 | |
if (initialPositionDifference % speedDifference) == 0 { | |
return "YES" | |
} else { | |
return "NO" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment