Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c0c4cc1

Browse files
add 2068
1 parent 9e10997 commit c0c4cc1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|2068|[Check Whether Two Strings are Almost Equivalent](https://leetcode.com/problems/check-whether-two-strings-are-almost-equivalent/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2068.java) ||Easy||
1112
|2063|[Vowels of All Substrings](https://leetcode.com/problems/vowels-of-all-substrings/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2063.java) ||Medium||
1213
|2062|[Count Vowel Substrings of a String](https://leetcode.com/problems/count-vowel-substrings-of-a-string/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2062.java) ||Easy||
1314
|2058|[Find the Minimum and Maximum Number of Nodes Between Critical Points](https://leetcode.com/problems/find-the-minimum-and-maximum-number-of-nodes-between-critical-points/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2058.java) ||Medium||
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2068 {
4+
public static class Solution1 {
5+
public boolean checkAlmostEquivalent(String word1, String word2) {
6+
int[] count = new int[26];
7+
for (char c : word1.toCharArray()) {
8+
count[c - 'a']++;
9+
}
10+
for (char c : word2.toCharArray()) {
11+
count[c - 'a']--;
12+
}
13+
for (int i : count) {
14+
if (Math.abs(i) > 3) {
15+
return false;
16+
}
17+
}
18+
return true;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)