Check if a string is rotation of another WITHOUT concatenating

Viewed 13241

There are 2 strings , how can we check if one is a rotated version of another ?

For Example : hello --- lohel

One simple solution is by concatenating first string with itself and checking if the other one is a substring of the concatenated version.

Is there any other solution to it ?

I was wondering if we could use circular linked list maybe ? But I am not able to arrive at the solution.

11 Answers
Related