Medium · Strings
Group Shifted Strings
Given an array of non-empty lowercase words strings, group the words that are shifts of one another (every letter moved forward by the same number of steps, with z wrapping around to a) and return the groups in any order.
Examples
Example 1
[abc, bcd, xyz, az]Output: [["abc","bcd","xyz"],["az"]]
Example 2
[acef, a, z, ry]Output: [["acef"],["a","z"],["ry"]]
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.