Design in-memory threshold switcher | Amazon Interview Question