help needed in leetcode problem

I am trying to do this [question][1] on leetcode. Can someone please tell me what is wrong with my

It is giving correct answer on codeblocks for the testcase which is failing on leetcode platform . However the same test case is giving correct answer when I run it as custom input on leetcode. Any suggestions:)
Thanks in advance. Please help.



add the condition (i < n) inside the while loop and then try.

edit : [
[“ate”, “eat”,“tea”],

I think that the output format is this i.e. you have to insert brackets also. Not sure about this! btw is there a way to know how many tests are passed? If yes and your code didn’t pass a single test than try to format it that way and try!

Let me know if it doesn’t works.

no success

i’ve updated my answer please look into it and feel free to contact if doesn’t work :slight_smile: