RBC Interview Question

Write a code and test its use cases and fix it