Hash Tables: Ice Cream Parlor

  • + 1 comment

    @Dan_Golding

    I just ran a small test to check if the Map[cost] to FlavorIdx approach has a bug in it. It does. This is why Gayle's YouTube video uses BinarySearch on Cost entries ordered by FlavorIdx.

    In this test sequence; the Flavor at position 2 overwrites/loses the flavor at position 1.

    What's interesting though; is that this test case appears to be missing from the Hacker Rank test suite; because this Map[cost] code approach was passing all of their test suite.

    Here's my Python code (formatted on next comment):