class Solution {
public:
int numSpecialEquivGroups(vector<string>& A) {
set<string> ST; for (auto a : A)
{
vector<char> V1;
vector<char> V2;
for (int i = ; i < a.length(); i++)
{
if (i % == )//下标偶数位:0 2 4 6 8...
{
V1.push_back(a[i]);
}
else//下标奇数位1 3 5 7 9...
{
V2.push_back(a[i]);
}
}
sort(V1.begin(), V1.end());
sort(V2.begin(), V2.end());
string X = "";
for (auto v : V1)
{
X.push_back(v);
}
for (auto v : V2)
{
X.push_back(v);
}
if (ST.find(X) == ST.end())//没有这条记录
{
ST.insert(X);
}
}
int count = ST.size();
return count;
}
};

leetcode893的更多相关文章

  1. [Swift]LeetCode893. 特殊等价字符串组 | Groups of Special-Equivalent Strings

    You are given an array A of strings. Two strings S and T are special-equivalent if after any number ...

随机推荐

  1. 记录下MD5加密遇到的坑

    错误的写法: public static String md5(String plainText) { byte[] secretBytes = null; try { secretBytes = M ...

  2. socket INADDR_ANY

    linux下的socket INADDR_ANY表示的是一个服务器上所有的网卡(服务器可能不止一个网卡)多个本地ip地址都进行绑定端口号,进行侦听. 不光是多个网卡的问题. 见如下server lis ...

  3. ng 监听数据的变化

    $scope.$watch('监听的变量的名称',func) 在angularJs之所以能够实现绑定,是因为angularJS框架在背后为每一个模型数据添加了一个监听,与$watch其实是一个道理. ...

  4. 前端之css样式01

    选择器,css文本属性 CSS语法: 选择器 {属性1: 值1; 属性2: 值2} CSS放置的位置: 1. 直接写在标签里面,通过style属性来设置CSS样式 2. 在head标签里面通过styl ...

  5. python 中出现 “IndentationError: expected an indented block” 问题

    python 学习 在定义Python函数的时候如下 >>>def hello() . . .print "hello" 这样会报错的,报错如下: Indenta ...

  6. 设置一个严格的SESSION过期时间

    认识一:当我们需要更改session生存时间的时候通行的做法是更改php.ini文件中 1: ; Name of the session (used as cookie name). 2: sessi ...

  7. MFC多语言程序版本,在不同的windows系统上的使用 FP_SetThreadUILanguage

    from: http://www.cnblogs.com/qijicxl/p/3840157.html 如何使MFC程序界面支持多国语言?这次使用后给自己做一个总结. 我们使用vc6.0的版本来试验 ...

  8. Java [Leetcode 347]Top K Frequent Elements

    题目描述: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1 ...

  9. c#和c++互操作(平台调用相关)

    [DllImport("ScreenCaptureLib.dll", CallingConvention = CallingConvention.Cdecl)] public st ...

  10. input子系统框架

    废话不多说,直接进入主题.在驱动insmod后,我们应用层对input设备如何操作?以下以全志a64为实例. 在/dev/input/eventX下(X的形成为后续会分析),是内核把接口暴露给应用层, ...