Flexport Interview Question

a leetcode medium question that can be solved via hashmap