I gave Amazon OA today on the Hackerrank platform. There were two questions to be done in 90 min. I expect a better solution in python 3 to pass all the test cases. If possible please provide code approach and time complexity.