Amazon OA 2023

image
image

I got this question on Amazon OA and I was able to pass only 3 testcases out of 15. Can anyone tell me it's solution?

Comments (3)