Shohei Yoshida
Shohei Yoshida's Blog

Shohei Yoshida's Blog

LeetCode 342. Power of Four in F#

Shohei Yoshida's photo
Shohei Yoshida
·Aug 22, 2022·

1 min read

URL

leetcode.com/problems/power-of-four

Code

github.com/syohex/dotnet-study/blob/master/..

let isPowerOfFour (n: int) : bool =
    seq { 0 .. 15 }
    |> Seq.tryFind (fun m -> System.Math.Pow(4, m) = n)
    |> Option.isSome
 
Share this