Couldn’t understand how to approach the problem.
Can u pls explain the approach to the problem and the intuition behind the approach ??
Couldn’t understand how to approach the problem.
Can u pls explain the approach to the problem and the intuition behind the approach ??
I think this can be done with the help of a map with strings as keys or with tries …
since implementing with map is easy i will explain u that.
but this approach will run in O(N*N), won’t it ? And we’ve to find an O(N) approach ! So i think tries should be used
No it will run in O(N*max(string.size))…so that’s fine since we do need to traverse in the strings otherwise how will we check the prefixes
but how will this approach take into account LCPs of len = 0 ?? I tried the approach but it is giving wa on sample tc
and i think my implementation isn’t working as reqd, can u pls tell where my implementation is going wrong ?
Hi sorry for the late reply… I couldn’t find error in ur code. Can u please ask this to ur mentor?