분류 전체보기
[Codility] Count Conforming Bitmasks
[Codility] Count Conforming Bitmasks
2024.02.19[Codility] Count Conforming Bitmasks https://app.codility.com/programmers/trainings/9/count_conforming_bitmasks/start/ Codility Your browser is not supported Please, update your browser or switch to a different one. Learn more about what browsers are supported app.codility.com 해결전략 비트마스크 Bitmask 비트연산자 주어진 정수 A, B, C 중 적어도 하나에 conform하는 다른 정수의 개수를 찾아야 한다. conform이라는 것은? 주어진 정수의 비트 중 하나라도 1이면, con..
[Codility] Disappearing Pairs
[Codility] Disappearing Pairs
2024.02.19[Codility] Disappearing Pairs https://app.codility.com/programmers/trainings/4/disappearing_pairs/start/ Codility Your browser is not supported Please, update your browser or switch to a different one. Learn more about what browsers are supported app.codility.com 해결전략 문자열 String 스택 Stack 처음 시도한 코드 - 시간초과 #include #include using namespace std; string solution(string& S) { int i = 0, j = 1; while ..
[Codility] Binary Gap
[Codility] Binary Gap
2024.02.18[Codility] Binary Gap https://app.codility.com/programmers/trainings/9/binary_gap/start/ Codility Your browser is not supported Please, update your browser or switch to a different one. Learn more about what browsers are supported app.codility.com 해결방안 비트 마스킹 Bitmasking Bitwise operations 정답코드 #include int answer; int solution(int N) { int n = N; int k = 0; while(n){ n /= 2; k++; } int cnt = 0; ..
[Codility] Array Inversion Count
[Codility] Array Inversion Count
2024.02.18[Codility] Array Inversion Count https://app.codility.com/programmers/trainings/4/array_inversion_count/start/ Codility Your browser is not supported Please, update your browser or switch to a different one. Learn more about what browsers are supported app.codility.com 해결전략 정렬 Sorting ※ 중요! QuickSort를 사용하면 안 된다!! 처음 시도한 코드 - 선택 정렬 (시간 초과) #include using namespace std; int solution(vector &A) { i..
[Codility] Tree Height
[Codility] Tree Height
2024.02.18[Codility] Tree Height 해결전략 이진트리 Binary Tree 정답코드 #include int answer; void DFS(tree* node, int currLength) { if(node == nullptr) return; answer = max(answer, currLength); if(node->l != nullptr){ DFS(node->l, currLength + 1); } if(node->r != nullptr){ DFS(node->r, currLength + 1); } } int solution(tree* T) { DFS(T, 0); return answer; } 유사문제 2024.02.18 - [⭐ 코딩테스트/Codility] - [Codility] Tree Longe..
[Codility] Tree Longest Zigzag
[Codility] Tree Longest Zigzag
2024.02.18[Codility] Tree Longest Zigzag https://app.codility.com/programmers/trainings/7/tree_longest_zig_zag/start/ Codility Your browser is not supported Please, update your browser or switch to a different one. Learn more about what browsers are supported app.codility.com 해결전략 이진트리 Binary Tree 정답코드 #include using namespace std; int answer; // Longest Zigzag Length void DFS(tree* node, int currLength, ..
2024.02.18 운동일지
2024.02.18 운동일지
2024.02.18실내 사이클 30분 + 맨몸운동 30분
[Codility] The Matrix
[Codility] The Matrix
2024.02.17[Codility] The Matrix https://app.codility.com/programmers/challenges/matrix2021/ The Matrix 2021 challenge Take part in our The Matrix 2021 challenge. app.codility.com 해결전략 이분탐색 정답 코드 #include #include using namespace std; bool Check(vector& A, int k) // Check 함수는 주어진 배열 A에서 k보다 크거나 같은 연속된 숫자의 개수가 k보다 크거나 같은지를 확인하는 함수 { int i = 0; while (i =..
[백준 1094번 C/C++] 막대기
[백준 1094번 C/C++] 막대기
2024.02.17[백준 1094번 C/C++] 막대기 https://www.acmicpc.net/problem/1094 1094번: 막대기 지민이는 길이가 64cm인 막대를 가지고 있다. 어느 날, 그는 길이가 Xcm인 막대가 가지고 싶어졌다. 지민이는 원래 가지고 있던 막대를 더 작은 막대로 자른다음에, 풀로 붙여서 길이가 Xcm인 막대 www.acmicpc.net 해결방안 비트 수학 주어진 수 x를 2진수로 표현했을 때의 1의 개수가 우리가 구하고자 하는 막대의 개수와 같다. 정답코드 #include using namespace std; int x; // 입력 받을 수 int cnt; // 막대의 개수 int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0..
[백준 14428번 C/C++] 수열과 쿼리 16
[백준 14428번 C/C++] 수열과 쿼리 16
2024.02.16이 글은 보호되어 있기 때문에 이것을 보려면 암호가 필요합니다.
2024.02.14 운동일지
2024.02.14 운동일지
2024.02.14조깅 + 걷기 4.25km
2024.02.13 운동일지
2024.02.13 운동일지
2024.02.13날씨가 풀려서 오랜만에 조깅~ 조깅 5.18km