LeetCode 334. Increasing Triplet Subsequence in F#
URL
leetcode.com/problems/increasing-triplet-su..
Code
github.com/syohex/dotnet-study/blob/master/..
let increasingTriplet (nums: int list) : bool =
let rec increasingTriplet' nums first second =
match nums with
| [] -> false
| h :: t ->
if h <= first then
increasingTriplet' t h second
elif h <= second then
increasingTriplet' t first h
else
true
increasingTriplet' nums System.Int32.MaxValue System.Int32.MaxValue