일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 백준알고리즘
- BFS
- 주식 용어
- 백준 2370
- 브루트포스
- 삼성SW 역량 테스트 기출문제
- 2370 c++
- 백준 알고리즘
- 시장 선거 포스터 c++
- 15651c++
- backtracking
- 프로그래머스
- DFS
- 백준 15651
- Programmers
- C++
- 백준
- fill함수
- 주식 용어 정리
- 삼성 SW역량 테스트
- 주린이
- 위상정렬
- 백준 1697
- 15651
- 용어 정리
- 백트레킹
- 에라토스테네스의 체
- DP
- 삼성 SW 역량 테스트 기출 문제
- MySQL
- Today
- Total
목록알고리즘/프로그래머스 알고리즘 (52)
빠켱이
이유는 잘 모르겠지만 arr배열의 이름을 처음에 firends로 선언했었는데, 런타임 오류가 나서 이름을 고치니까 해결됬었습니다. #include #include #include using namespace std; int count_num; char arr[8] = {'A', 'C', 'F', 'J', 'M', 'N', 'R', 'T'}; char line[8] = {NULL,}; bool check[8] = {false,}; void dfs(int index, vector data){ if(index == 8){ for(int i = 0; i < data.size(); i++){ char c = data[i][3]; int dis = data[i][4] - '0' + 1; int index1 = -1..
#include #include #include using namespace std; int index; bool compare(string s1, string s2){ if(s1[index] != s2[index]) return s1[index] < s2[index]; else return s1 < s2; } vector solution(vector strings, int n) { vector answer; index = n; sort(strings.begin(), strings.end(), compare); answer = strings; return answer; }
#include #include #include using namespace std; long long solution(int a, int b) { long long answer = 0; if(a == b) answer = a; else{ int min_value = min(a, b); int max_value = max(a, b); for(long long i = min_value; i
#include #include #include using namespace std; vector solution(vector arr, int divisor) { vector answer; for(int i = 0; i < arr.size(); i++) if(arr[i] % divisor == 0) answer.push_back(arr[i]); sort(answer.begin(), answer.end()); if(answer.size() == 0) answer.push_back(-1); return answer; }
#include #include using namespace std; vector solution(vector arr) { vector answer; int before = arr[0]; if(arr.size() > 0){ answer.push_back(before); for(int i = 1; i < arr.size(); i++){ if(before != arr[i]){ answer.push_back(arr[i]); before = arr[i]; } } } return answer; }
#include #include #include #include using namespace std; int solution(int n) { int answer = 0; vector three; while(n > 0){ three.push_back(n % 3); n /= 3; } reverse(three.begin(), three.end()); for(int i = 0; i < three.size(); i++) answer += (three[i] * pow(3,i)); return answer; }