Skip to content

Commit d682e93

Browse files
committed
valid-anagram solution
1 parent d84be8f commit d682e93

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

valid-anagram/rlawjd10.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// 모든 철자가 있는지 확인
2+
class Solution {
3+
public:
4+
bool isAnagram(string s, string t) {
5+
// 1. 문자열 정렬
6+
sort(s.begin(), s.end());
7+
sort(t.begin(), t.end());
8+
9+
// 2. 비교
10+
if (s.compare(t) == 0)
11+
return 1;
12+
13+
return 0;
14+
}
15+
};
16+

0 commit comments

Comments
 (0)