Backbase interview question

2 Coding questions of medium difficulty.