LeetCode 263. Ugly Number in F#
URL
leetcode.com/problems/ugly-number
Code
github.com/syohex/dotnet-study/blob/master/..
let isUgly (n: int) : bool =
let rec div divisor (n: int) =
if n % divisor <> 0 then
n
else
div divisor (n / divisor)
if n <= 0 then
false
else
(n |> div 2 |> div 3 |> div 5) = 1