检查棋盘方格颜色---字符串

题目

String类型

解答

class Solution {
public boolean checkTwoChessboards(String s, String t) {
int a = (s.charAt(0) + s.charAt(1)) % 2;
int b = (t.charAt(0) + t.charAt(1)) % 2;
return a == b;
}
}

posted @ 2024-12-03 11:55  TTDB  阅读(22)  评论(0)    收藏  举报