LeetCode 24. Swap Nodes in Pairs in F#

URL

leetcode.com/problems/swap-nodes-in-pairs

Code

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

type LinkedList =
    | Empty
    | ListNode of int * LinkedList

let rec swapPair (node: LinkedList) : LinkedList =
    match node with
    | Empty -> Empty
    | ListNode (x, next) ->
        match next with
        | Empty -> node
        | ListNode (y, nnext) -> ListNode(y, ListNode(x, (swapPair nnext)))

This problem is not suit for F#