일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 딥러닝
- C++
- omscs
- leetcode
- Plotting
- 개발자
- 기본
- 방통대
- 머신러닝
- cpp
- 컴퓨터과학과
- 코딩테스트
- 알고리즘
- 선형대수
- machine learning
- 마니토바
- 프로그래머스
- MATLAB
- 캐나다 영주권
- LAA
- Deep learning
- 방송통신대학교
- 주정부이민
- 조지아텍
- LV1
- 매트랩
- zeros
- EOI
- 온라인석사
- mpnp
Archives
- Today
- Total
Krononberg
1309. Decrypt String from Alphabet to Integer Mapping.cpp 본문
class Solution {
public:
string freqAlphabets(string s) {
//1~9
//10#~26#
string res="";
string tmp ="";
for(int i =0; i<s.size();){
if(i+2 <s.size() && s[i+2]=='#'){
tmp+=s[i];
tmp+=s[i+1];
int x = stoi(tmp)-1;
res += char('a'+ x);
cout << char(x + 'a') <<" ";
tmp ="";
i+=3;
}
else{
tmp =s[i];
int x = stoi(tmp)-1;
res += char('a'+ x);
tmp = "";
i++;
}
}
return res;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
1370. Increasing Decreasing String.cpp (0) | 2021.10.06 |
---|---|
1630. Arithmetic Subarrays.cpp (0) | 2021.10.06 |
1827. Minimum Operations to Make the Array Increasing.cpp (0) | 2021.10.05 |
1863. Sum of All Subset XOR Totals.cpp (0) | 2021.10.04 |
1382. Balance a Binary Search Tree.cpp (0) | 2021.10.04 |