Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab759a5

Browse files
add 2186
1 parenta0b9a32 commitab759a5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-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+
| 2186|[Minimum Number of Steps to Make Two Strings Anagram II](https://leetcode.com/problems/minimum-number-of-steps-to-make-two-strings-anagram-ii/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2186.java)||Medium||
1112
| 2185|[Counting Words With a Given Prefix](https://leetcode.com/problems/counting-words-with-a-given-prefix/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2185.java)||Easy||
1213
| 2182|[Construct String With Repeat Limit](https://leetcode.com/problems/construct-string-with-repeat-limit/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2182.java)||Medium||
1314
| 2181|[Merge Nodes in Between Zeros](https://leetcode.com/problems/merge-nodes-in-between-zeros/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2181.java)||Medium||
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_2186 {
4+
publicstaticclassSolution1 {
5+
publicintminSteps(Strings,Stringt) {
6+
int[]counts =newint[26];
7+
for (inti =0;i <s.length();i++) {
8+
counts[s.charAt(i) -'a']++;
9+
}
10+
for (inti =0;i <t.length();i++) {
11+
counts[t.charAt(i) -'a']--;
12+
}
13+
intans =0;
14+
for (inti =0;i <counts.length;i++) {
15+
ans +=Math.abs(counts[i]);
16+
}
17+
returnans;
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp