go-dsa icon indicating copy to clipboard operation
go-dsa copied to clipboard

strings/longest_dictionary_word.go solution is wrong

Open ranahemantkumar opened this issue 7 months ago • 0 comments

A clear and concise description of what the problem

strings/longest_dictionary_word.go solution fails for below use case: when key = "a" , dic = []string{"c"}, expected output should be "" because key not occurs in any of input string

Any code examples?

{"a", []string{"c"}, ""} add above use case to tests to see it fails

What effort have you taken to solve this problem?

I haven't reached to optimal solution yet. The one i wrote initially takes O(n**2) time so its not best solution i guess. Still looking for another solution, will post if i get any.

Additional context

ranahemantkumar avatar Sep 12 '25 03:09 ranahemantkumar