一、题目
二、分析与解答
用一个52位的数组,分别存对应字符串偶数位字母的数量和奇数位字母的数量。
class Solution {public int numSpecialEquivGroups(String[] words) {Set<String> seen = new HashSet<>();for(String S : words) {int[] count = new int[52];for(int i = 0;i < S.length();i++) {count[S.charAt(i) - 'a' + 26 *(i%2)]++;}seen.add(Arrays.toString(count));}return seen.size();}}
