KhataBook Interview Question

Generic ds/ps problem, js, react, etc