LeetCode 2849. Determine if a Cell Is Reachable at a Given Time in F#
URL
Determine if a Cell Is Reachable at a Given Time - LeetCode
Code
https://github.com/syohex/dotnet-study/tree/master/fsharp/leetcode/problems/2849/main.fsx
open System
let isReachableAtTime (sx: int) (sy: int) (fx: int) (fy: int) (t: int) : bool =
let xDist = Math.Abs(sx - fx)
let yDist = Math.Abs(sy - fy)
if xDist = 0 && yDist = 0 && t = 1 then
false
else
t >= Math.Max(xDist, yDist)