Amazon Interview Question

Code to organize data given 2-3 database