https://leetcode.cn/problems/find-maximum-number-of-string-pairs/
class Solution {
public int maximumNumberOfStringPairs(String[] words) {
Set<String> set = new HashSet<>();
int res = 0;
for (int i = 0; i < words.length; i ++) {
String a = words[i];
if (set.contains(a)) {
res ++;
set.remove(a);
} else {
set.add(new StringBuilder(a).reverse().toString());
}
}
return res;
}
}
https://leetcode.cn/problems/construct-the-longest-new-string/description/
class Solution {
public int longestString(int x, int y, int z) {
return (Math.min(x, y) * 2 + (x != y ? 1 : 0) + z) * 2;
}
}
https://leetcode.cn/problems/decremental-string-concatenation/
https://leetcode.cn/problems/count-zero-request-servers/