Jane Street Interview Question

leetcode medium involving dictionaries and loops