Solved

Should approved be a set instead of a list?

FreyaLOP

in on a list checks every item. Wouldn't a set be faster?

1

Comments 4

Join the discussion

Already have an account? Log in

  1. SamPrice Solutionreplies: 1

    Yes, for large collections a set is much faster (constant time lookup). For a handful of IDs it doesn't matter. The challenge uses a list to keep it simple, but your instinct is right for real code.

    6
    1. FreyaLOP

      Good to know I'm thinking in the right direction.

      2
    2. CharlieH

      Remember the nested loops article — sets turned minutes into seconds there.

      0
      1. TomBecker

        Stage 2 cleaning with strip + upper is the important part. Hand-typed IDs are always messy.

        3