-
[C++] Programmers study week #4Problem Solving/Programmers 2023. 3. 1. 01:10
점찍기 [C++] Programmers | 점찍기 점찍기 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr / suddiyo.tistory.com 할인행사 [C++] Programmers | 할인행사 할인행사 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.k suddiyo.tistory.com 프린터 [C++] Programmers | 프린터 프린터 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭...
-
[C++] Programmers | 숫자 변환하기Problem Solving/Programmers 2023. 3. 1. 00:56
숫자 변환하기 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ✅ Accept Code // programmers week3-7 // 숫자 변환하기 #include using namespace std; bool visited[1000001]; int solution(int x, int y, int n) { queue Q; Q.push({x, 0}); while (!Q.empty()) { int num = Q.front().first; int cnt = Q.front().second; Q.pop(); if (num == y) return cnt; visite..
-
[C++] Programmers | 다음 큰 숫자Problem Solving/Programmers 2023. 3. 1. 00:56
다음 큰 숫자 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ✅ Accept Code // programmers week3-6 // 다음 큰 숫자 #include using namespace std; int solution(int n) { string n_binary = bitset(n).to_string(); int total = 0; for (int i = 0; i < n_binary.size(); i++) { if (n_binary[i] == '1') total++; } while (1) { n++; string binary = bitset(n).t..
-
[C++] Programmers | 여행 경로Problem Solving/Programmers 2023. 3. 1. 00:55
여행 경로 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ✅ Accept Code // programmers week3-5 // 여행 경로 #include using namespace std; bool visited[100000001]; vector path; int flag = 0; void DFS(vector tickets, string cur, int cnt) { if (cnt == tickets.size()) { flag = 1; return; } for (int i = 0; i < tickets.size(); i++) { if (tickets[i..
-
[C++] Programmers | 124 나라의 숫자Problem Solving/Programmers 2023. 3. 1. 00:54
124 나라의 숫자 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ✅ Accept Code // programmers week3-4 // 블로그 참고 #include using namespace std; string solution(int n) { string answer = ""; int quotient = n; int remainder = 0; while(quotient) { remainder = quotient % 3; quotient = quotient / 3; switch (remainder) { case 0: answer = "4" + answ..
-
[C++] Programmers | k진수에서 소수 개수 구하기Problem Solving/Programmers 2023. 3. 1. 00:52
k진수에서 소수 개수 구하기 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ✅ Accept Code // programmers week3-3 // k진수에서 소수 개수 구하기 #include using namespace std; bool isPrime(long long n) { if (n < 2) return false; for (int i = 2; i = 0; i--) { if (i == 0 && V[i] != 0) { str += (V[i] + '0'); nums.push_back(str); break; } if (V[i] == 0) { if (str..
-
[Spring] SOLID | 좋은 객체 지향 설계의 5가지 원칙Spring 2023. 2. 11. 18:41
SOLID SRP: 단일 책임 원칙 (Single responsibility principle) OCP: 개방-폐쇄 원칙 (Open/closed principle) LSP: 리스코프 치환 원칙 (Liskov substitution principle) ISP: 인터페이스 분리 원칙 (Interface segregation principle) DIP: 의존관계 역전 원칙 (Dependency inversion principle) 1️⃣ SRP 단일 책임 원칙 Single responsibility principle 한 클래스는 하나의 책임만 가져야 한다. 하나의 책임이라는 것은 모호하다. - 클 수 있고, 작을 수 있다. - 문맥과 상황에 따라 다르다. 중요한 기준은 변경이다. 변경이 있을 때 파급 효과가 ..
-
[C++] Programmers | 무인도 여행Problem Solving/Programmers 2023. 2. 5. 12:01
무인도 여행 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ✅ Accept Code // programmers week3-2 // 무인도 여행 // BFS #include using namespace std; int island[100][100]; bool visited[100][100]; vector V; vector days; int di[4] = {0, 0, 1, -1}; int dj[4] = {1, -1, 0, 0}; vector solution(vector maps) { for (int i = 0; i < maps.size(); i++) { fo..