• wewbull@feddit.uk
    link
    fedilink
    English
    arrow-up
    1
    ·
    12 days ago

    When you’re given an array of characters, and your first step is “I’m going to store that in a map of (int , int) -> char” I think you need to question your methods.

    • Noughtmare@programming.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      12 days ago

      Why? They immediately explain that the difference in performance would not be significant on such a small problem and I see no other reason to prefer arrays over maps.

  • wewbull@feddit.uk
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 days ago

    The advent of code is to help people learn, and part of that is teaching people that the data structures matters. Toy problems help people see patterns, and just going “we’ll use a map despite it being a poor choice” doesn’t teach anything except an anti-pattern.

    • Joe@functional.cafe
      link
      fedilink
      arrow-up
      2
      ·
      11 days ago

      @wewbull @Noughtmare knowing when to say “this isn’t the perfect data structure, but it’s convenient, and it’s fine for this use-case” is a perfectly acceptable lesson to learn