249. Group Shifted Strings
https://leetcode.com/problems/group-shifted-strings/
Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd"
. We can keep "shifting" which forms the sequence:
Given a list of strings which contains only lowercase alphabets, group all strings that belong to the same shifting sequence.
Example:
只由小写字母组成的字符串可根据它自身字符间的等差pattern做shift,把相同的pattern的归到一组。对每个字符串算pattern,因为只包含小写字母,当字符相差为负时要加26,为方便统一全部加26取模。
Last updated
Was this helpful?