My solution does not work for the test case of value 10, so this question can have an edge test case of 10.
This Question Can be improved
What answer does your solution print for this test case
It gives anull. However, I figured out how to handle this case but my submitted code does not handle this situation.