Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 3sum/mkwkw.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SamTheKorean 이 파일처럼 비었지만 Merge 된 경우가 더 있네요: #1756 (comment)

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//set-up
1 change: 1 addition & 0 deletions climbing-stairs/mkwkw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//set-up
1 change: 1 addition & 0 deletions product-of-array-except-self/mkwkw.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SamTheKorean 이 파일처럼 비었지만 Merge 된 경우가 더 있네요: #1756 (comment)

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//set-up
37 changes: 37 additions & 0 deletions valid-anagram/mkwkw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//map: key:alphabet, value:count
//if t is an anagram of s
// 1. same length
// 2. same content of map
class Solution {
public:
bool isAnagram(string s, string t) {

//1. different length -> false
if(s.length()!=t.length())
{
return false;
}

//2. different map -> false
map<char, int> sMap, tMap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배열이나 unordered_map을 사용할 수도 있겠군요.

for(int i=0; i<s.length(); i++)
{
sMap[s[i]]++;
tMap[t[i]]++;
}

for(auto c : sMap)
{
if(tMap.find(c.first)==tMap.end())
{
return false;
}
if(tMap[c.first] != c.second)
{
return false;
}
}

return true;
}
};
1 change: 1 addition & 0 deletions validate-binary-search-tree/mkwkw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//set-up