Back to problems

Rotate String (variant with two string arrays)

Algorithm · Microsoft · Medium

Problem You are given two arrays of strings, A and B, both of length n. For each index i, you may rotate the string A[i] any number of times. A rotation is a cyclic shift of the characters: moving some number of characters from the front to the back. Your task is to decide whether it is possible to rotate each A[i] independently so that, after all rotations, the two arrays are identical element by element. Return true if such a set of rotations exists; otherwise return…

Checking your access…