In this question I am applying DFS to solve it. I go down to the lowest level of any word. Then again I apply DFS from the next word. But I am being given TLE on test case 29 continuously. In test case 29, there is only one string with no children : string,0 (something like this). Can someone help me with my code or is my complexity itself too high for my solution to be correct. Here is my solution link : http://ideone.com/hiaumA . Thank-you in advance.