can i get the code of unique words pair
Unique Words Pair Hint
first try at your own
i can provide you approach to this problem
- Create an map or trie(obiously trie is much better than map but for simplicity use can use map)
- Do following for every word:-
a) Insert reverse of current word.
b) Also store up to which index it is
a palindrome. - Traverse list of words again and do following
for every word.
a) If it is available in map/Trie then return true
b) If it is partially available
Check the remaining word is palindrome or not
If yes then return true that means a pair
forms a palindrome.
if your doubt is resolved
Please mark it as resolved
if you have any doubt regarding this feel free to ask
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.