Skip to content

Commit d960abe

Browse files
committed
valid anagram 문제
1 parent 4e5b362 commit d960abe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

valid-anagram/ymir0804.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import java.util.Set;
2+
import java.util.stream.Collectors;
3+
4+
class Solution {
5+
public boolean isAnagram(String s, String t) {
6+
Set<Character> characterS = s.chars()
7+
.mapToObj(c -> (char) c)
8+
.collect(Collectors.toSet());
9+
Set<Character> characterT = t.chars()
10+
.mapToObj(c -> (char) c)
11+
.collect(Collectors.toSet());
12+
return characterS.equals(characterT);
13+
}
14+
}

0 commit comments

Comments
 (0)