Amazon Interview Question

2 coding ques, mcqs for selecting based on choice