It is one thing to know the syntax, it is another thing to know the logic. PS: The test cases were mad!!! I had to come up with 3 solutions to meet all. And hey chatgpt solution could not pass all 3 test cases