I'm facing problem with this question. I'm getting TLE on test case 19th. I'm doing this question using Tries. Complexity of my code is O(3 * total length of input) which is no where close to getting TLE. Here is my code : http://ideone.com/uNbDf9. Please help
Doesnt
strcpy()
run in O(n) time?I have changed my code but i guess the problem would still come as search function takes O(length). Is there any way of solving this question using Tries?