Calculate String Rotation
Approach
if swhiftedWord is same with targetWord return process repeat count
if count is over than shiftedWord return -1 because that means it's already roatat one cycle but didn't match with targetWord
if passed process-1, process-2 go back to process-1 with one shifted to the right word with increased count
Solution
Last updated
Was this helpful?