Amazon Interview Question

To build a efficient keypad.