Ice Cream Parlor

  • + 0 comments

    using a hash_map in a simple O(n) sol

    def icecreamParlor(m, arr):
        # Write your code here
        hash_table = {}
        for index, element in enumerate(arr):
            if element in hash_table:
                return sorted((index+1, hash_table[element]))
            else:
                hash_table[m - element] = index+1