cant identify mistake
getting wrong answer
Unique word pair hint
Hey Dakshi, I see your implementation is little bit incorrect! Please take care of these:
- Don’t make entry of substrings into hashmap (make only for given strings).
- give a check whether current string can be a prefix! for that consider every prefix and see whether reverse of it is present and remaining string is palindrome.
for this j should go from 0 to length (not <length, as an edge case involves empty string as well) - Do similar for suffix check!
There can be duplicate pairs as well in final answer so take care of them as well(eg answer may contain {0,3},{0,3} twice.)