Design a memory usage switcher with thresholds | Amazon Interview Question