What is time complexity of string::rfind method in c++?
From what I understood, rfind is reversing the string and then doing string::find. Am I correct? Then it should be O(n)
>Solution :
No, you are not correct. rfind searches from the back of the string without reversing the string. The complexity is the same as for a forward find