I want to know how to check prefix in this problem.
Check prefix of another string
Hello @Divyansh_2000,
- You the inbuilt sort() function and pass the compare function in it as the third parameter.
- Inside compare function compare the two strings character by character from right to left.
- If all the characters of one string are completely matched with others then it is the prefix of others.
- If the comparison fails at any index then compare the in terms of lexicographical order.
Hope, this would help.
Give a like if you are satisfied.
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.