Amazon Interview Question

Introduction, Approach of questions, TCs, SCs, and code implementation