Amazon Interview Question

A leetcode style question relating to dicts