일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 방송통신대학교
- MATLAB
- omscs
- Deep learning
- 매트랩
- zeros
- 기본
- 딥러닝
- 방통대
- machine learning
- 프로그래머스
- 캐나다 영주권
- 주정부이민
- EOI
- LAA
- Plotting
- leetcode
- 선형대수
- 조지아텍
- cpp
- 머신러닝
- 컴퓨터과학과
- 개발자
- 코딩테스트
- C++
- LV1
- 위니펙
- 온라인석사
- 알고리즘
- mpnp
Archives
- Today
- Total
Byte by Byte
1347. Minimum Number of Steps to Make Two Strings Anagram.cpp 본문
개발 로그/알고리즘
1347. Minimum Number of Steps to Make Two Strings Anagram.cpp
CyberSoak 2021. 10. 8. 14:23class Solution {
public:
int minSteps(string s, string t) {
map<char,int>m;
map<char,int>m2;
int res=0;
for(int i =0; i<s.size(); i++){
m[s[i]]++;
m2[t[i]]++;
}
for(auto it : m){
// // res += m[s[i]] - m2[s[i]];
// cout<<it.second << " ";
// cout<< m2[it.first];
// // cout<<m2[s[i]] << " ";
// cout << endl;
if(it.second>m2[it.first])
res += (it.second - m2[it.first]);
}
return res;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
590. N-ary Tree Postorder Traversal.cpp (0) | 2021.10.08 |
---|---|
1261. Find Elements in a Contaminated Binary Tree.cpp (0) | 2021.10.08 |
897. Increasing Order Search Tree.cpp (0) | 2021.10.08 |
890. Find and Replace Pattern.cpp (0) | 2021.10.07 |
1079. Letter Tile Possibilities.cpp (0) | 2021.10.07 |