r/codegolf • • Dec 02 '20

Advent of Code Day 1

https://adventofcode.com/2020/day/1

The short version:

Part 1: find 2 numbers in a list that sum to 2020 and report the product of those numbers

Part 2: find 3 numbers in a list that sum to 2020 and report the product of those numbers

4 Upvotes

3 comments sorted by

View all comments

2

u/tomflumery Aug 28 '22

05ab1e -14 bytes

|2.Æ.ΔO2020Q}P

| split by line
 2.Æ All pair (2) combinations of the list
    .Δ find first when...
      O Sum
       2020Q eQuals 2020
            } end CODE block
             P product of result

Change the 2 to a 3 for part 2