Day 1: Dusty Shed

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

  • Ismail@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    2 days ago

    TXR

    The 'hist-sort' function call does most of the work here, creating an association list of (id . freq) pairs in decreasing order of frequency:

    @(next "01-input")
    @(collect)
    @  ids
    @(end)
    @;;
    @(bind freqs @(hist-sort [map int-str ids]))
    @;;
    @(output)
    1: @[prod (take 3 freqs) car]
    2: @[prod (last freqs 3) car]
    @(end)