LeetCode Weekly Contest 161
問題文
省略
省略
C++に変換後のコードはこちら
#define main dummy_main
{}
#undef main
class Solution {
public:
int minimumSwap(string s1, string s2) {
int N = s1.size(), xy = 0, yx = 0;
rep(i,N){
if(s1[i] == 'x' && s2[i] == 'y') xy++;
if(s1[i] == 'y' && s2[i] == 'x') yx++;
}
if((xy + yx) % 2) return -1;
return (xy /+ 2) + (yx /+ 2);
}
};
Current time: 2024年04月26日02時36分34秒
Last modified: 2019年11月03日20時07分18秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)