일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- c++ #boj #
- boj #백준
- graph #최단경로
- BOJ
- 최소 #공배수 #최대 #공약수 #유클리드 #호제법 #lcm #gcd #c++ #boj #3343 #백준 #장미
- hcpc
- 레드아보
- 3D #Reconstruction #computer #vision #volume #metric #tsdf #kinect #fusion
- N번째큰수
- c++ #입출력 #속도 #ios #sync_with_stdio #cin #cout #tie
- 30870
- C++
- 16202
- 투포인터 #백준 #boj #20922 #22862
- 22869
- 사이클 없는 그래프
- 1174
- 백준 #다익스트라 #dijkstra #9370 #c++
- 3343
- 쌤쌤쌤
- LIS #가장긴증가하는부분수열 #
- 줄어드는수
- backtracking #codetree #디버깅 #삼성코테
- graph
- 코딩
- 호반우 상인
- 진법변환 #2to10 #10to2 #이진법 #십진법 #변환 #bitset #c++
- 20117
- 백준
- 이분탐색 #dp #11053
- Today
- Total
목록알고리즘 연습/프로그래머스 (17)
hyunjin
https://programmers.co.kr/learn/courses/30/lessons/42587 예전에 시도했다가 실패한 문제다. 오랜만에 다시 풀어본다. 예전에 풀었던 실패한 방식이다. 1차 실패 class Solution { public int solution(int[] priorities, int location) { int answer = 1; int size = priorities.length,temp; int targetPrior = priorities[location]; int flag []= new int[size]; int start = 0,index; for(int i =0; i 0) { ..
https://programmers.co.kr/learn/courses/30/lessons/42576 1차 풀이 방법 #include #include #include using namespace std; string solution(vector participant, vector completion) { unordered_map hash; for (string name:completion) { if (hash.end() == hash.find(name)) hash.insert(make_pair(name, 1)); else hash[name]++; } for (string name : participant) { if (hash.end() == hash.find(name)) return name; else ..
https://programmers.co.kr/learn/courses/30/lessons/12918/solution_groups?language=cpp 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; bool solution(string s) { bool answer = true; if(s.length() != 4 && s.length() != 6 ) return false; for(int i = 0 ; i < s.length() ; i++){ if(s[i]-'0' < 0 || s[i]..
https://programmers.co.kr/learn/courses/30/lessons/42588 코딩테스트 연습 - 탑 수평 직선에 탑 N대를 세웠습니다. 모든 탑의 꼭대기에는 신호를 송/수신하는 장치를 설치했습니다. 발사한 신호는 신호를 보낸 탑보다 높은 탑에서만 수신합니다. 또한, 한 번 수신된 신호는 다 programmers.co.kr 스택과 큐를 활용하여 푸는 문제다. 이중 for 문을 사용하여 풀었다. 스택/큐 문제인데 사용하지 않아서 음.... +2점을 얻었다. #include #include using namespace std; vector solution(vector heights) { vector answer(heights.size()); int index = 0; answer[0]..
첫 번째 방법 #include #include #include #include using namespace std; string solution(vector numbers, string hand) { string answer = ""; int l=9,r=11; for(int i = 0 ; i < numbers.size();i++){ if(numbers[i] == 0) numbers[i] = 10; else numbers[i]--; if(numbers[i]%3==0){ answer += "L"; l = numbers[i]; } else if(numbers[i]%3 == 2){ answer += "R"; r = numbers[i]; } else{ int h = numbers[i]/3; int tmp1 = a..
https://programmers.co.kr/learn/courses/30/lessons/12922 코딩테스트 연습 - 수박수박수박수박수박수? 길이가 n이고, 수박수박수박수....와 같은 패턴을 유지하는 문자열을 리턴하는 함수, solution을 완성하세요. 예를들어 n이 4이면 수박수박을 리턴하고 3이라면 수박수를 리턴하면 됩니다. 제한 조�� programmers.co.kr #include #include using namespace std; string solution(int n) { string answer = ""; for(int i = 1 ; i
https://programmers.co.kr/learn/courses/30/lessons/12982?language=cpp 난이도가 쉬운 문제였다. #include #include #include #include #include using namespace std; int solution(vector d, int budget) { int answer = 0; sort(d.begin(),d.end()); for(auto iter = d.begin();iter!=d.end();iter++){ budget -= *iter; if(budget < 0 )break; else answer++; } return answer; } 1. sort 함수 사용 헤더파일 : 3번째 인자로 내가 원하는 비교문을 넣을 수 있다..
https://programmers.co.kr/learn/courses/30/lessons/42584?language=cpp 코딩테스트 연습 - 주식가격 초 단위로 기록된 주식가격이 담긴 배열 prices가 매개변수로 주어질 때, 가격이 떨어지지 않은 기간은 몇 초인지를 return 하도록 solution 함수를 완성하세요. 제한사항 prices의 각 가격은 1 이상 10,00 programmers.co.kr #include #include #include using namespace std; vector solution(vector prices) { vector answer; int len = prices.size(); answer.push_back(0); for (int i = len - 2; i >..