W7RKL7EQWB4HARQS4XASRQOA2KUK5XZWJU3ZYMMKDQKF4WUQLFVAC
OHEKH6Q3CVVLL5BMLZ4JAV3HCVRWRUYQQQ7CYSXXMKYHKNSSLK2AC
let part1 = [ for a in arr do for b in arr do if a + b = 2020 then (a * b) ]
let part1 =
[ for a in arr do
for b in arr do
if a + b = 2020 then
(a * b) ]
let tupleToArray2 t = match t with | (a, b) -> [| a; b |]let tupleToArray3 t = match t with | (a, b, c) -> [| a; b; c |]
let tupleToArray2 t =
match t with
| (a, b) -> [| a; b |]
let tupleToArray3 t =
| (a, b, c) -> [| a; b; c |]
let part2 = [ for a in arr do
let part2 =
let part1 (arr: int list) = query { for a in arr do for b in arr do find (a + b = 2020)}let part2 (arr: int list) = query { for a in arr do
let part1 (arr: int list) = query {
for a in arr do
find (a + b = 2020)
}
let part2 (arr: int list) = query {
if a + b + c = 2020 then (a * b * c) ]
if a + b + c = 2020 then
(a * b * c) ]
find (a + b + c = 2020)}
find (a + b + c = 2020)
printfn "%d" part1.[0] printfn "%d" part2.[0] 0 // return an integer exit code
printfn "%d" part1.[0]
printfn "%d" part2.[0]
0 // return an integer exit code
let v = part1 arr |> tupleToArray2 |> Array.reduce (*) printfn "%d" v let v2 = part2 arr |> tupleToArray3 |> Array.reduce (*) printfn "%d" v2 0
let v = part1 arr |> tupleToArray2 |> Array.reduce (*)
printfn "%d" v
let v2 = part2 arr |> tupleToArray3 |> Array.reduce (*)
printfn "%d" v2
0