일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- English
- 삼성
- 알고리즘
- SQL
- nightroutine
- D4
- STUDYENGLISH
- 원서읽기
- the midnight library
- 코테
- 코딩테스트
- sw expert academy
- englishbook
- BFS
- 프로그래머스
- 알고리즘 문제
- 백준
- MySQL
- 완전탐색
- sw expert
- swexpertacademy
- 코테 대비
- 원서읽자
- 쉬운 알고리즘 문제
- dfs
- PyQt
- 코테 준비
- 직무면접
- readingbook
- 원서
- Today
- Total
목록전체 글 (172)
시나브로
1. skill에 있는 알파벳을 배열에 체크한다. 체크할 때 순서로 표시한다. 2. 각 스킬트리를 보면서 skill에 있는 알파벳이 나오면 순서를 체크하면서 한다. #include #include using namespace std; int solution(string skill, vector skill_trees) { int alpha[30] = { 0 }; for (int i = 0; i < skill.length(); i++) { alpha[skill[i] - 'A']=i+1; } int count = 0; for (int i = 0; i < skill_trees.size(); i++) { int memory = 0; int fail = 0; for (int k = 0; k < skill_trees..
규칙성을 찾는다고 찾았는데 잘못찾았다. 검색으로 찾은 규칙성은 최대 공약수로 나눈 크기의 사각형에서는 가로+세로-1의 사각형들이 잘린다는 것이다. 그래서 최대공약수를 찾고 계산하면 된다. using namespace std; long long solution(int w, int h) { long long answer = 1; int fix = w; int f_w = w; int f_h = h; if (w 0; i--) { if (w % i == 0 && h % i == 0) { w =w/i; h =h/i; break; } } long long number = 0; number = (f_h/h)*(h+w-1); answer = (lo..
진짜 많은 고생을 한 문제이다. 3진법으로 변환하는 것을 알았는데 진법 변화할 때 나오는 0이 문제였다. point1 . 진법 변환시 나오는 0,3을 4로 대처한다. 그 이유는 변화할 때, 나오는 숫자가 0,1,2 이기 때문에 0,3이 4를 의미한다. point2. 0을 4로 변경하면, 앞에 수를 하나 줄여야한다. 그 이유는 뺄셈을 할 때와 유사하다. point3. 진법 변환시 나오는 3은 그 이상 진법번환을 진행하지 않고, 3을 4로 대처한다. 1. 나머지 값을 계산하여 box에 숫자를 입력한다. 이때 0을 4로 변경하였으면, 내림이 필요하기 때문에 signal 변수로 내림을 표시해준다. 2. n/3을 한다. 3. 이후, 1,2 과정을 반복하는데 내림이 표시되어있을 경우, 하나 단계 숫자를 줄일다. 여..
각 시점마다 오름차순인지 내림차순인지 확인해서 이전꺼와 다르다면 새로운 묶음으로 본다는 것에서 포인트를 얻어서 풀었다. #include #include #include #include using namespace std; int list[100010]; int signal = -1; void search_signal(int i) { if (list[i] list[i+1]) { signal = 2; } else { signal = 0; } } int main(void) { freopen("inp.inp", "r", stdin); freopen("out.out", "w", stdout); int tc = 0; cin >> ..
#include #include using namespace std; vector solution(vector progresses, vector speeds) { vector answer; int list[110]={0}; for(int i=0;ii){ i++; count++; } answer.push_back(count); } return answer; } https://programmers.co.kr/learn/courses/30/lessons/42586 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr
#include #include #include using namespace std; int solution(int bridge_length, int weight, vector truck_weights) { int answer = 0; int time=0; int pass_point=0; int in_point=0; int box=truck_weights.size(); vectorlist; int rest_time=weight; while(1){ if(truck_weights.size()
#include #include using namespace std; vector solution(vector heights) { int box=heights.size(); vector answer(box, 0); vector list; for (int i = heights.size()-1; i >= 0; i--) { if (list.size() != 0) { while (1) { if (list.size() != 0) { if (heights[i] > heights[list.back()]) { answer[list.back()] = i + 1; list.pop_back(); } else break; } else break; } } list.push_back(i); } return answer; } ht..
정렬을 한 이후, 최소값(start_point)과 m보다 작은 최댓값(end_point) 2개를 가지고 두개의 합이 m보다 클 경우, end_point를 옮겨서 두 개의 합을 줄이도록 하였다. 두개의 합이 m보다 작을 경우, start_point를 옮겨서 두개의 합을 크게하도록하엿다. #include #include #include using namespace std; int main(void) { freopen("inp.inp", "r", stdin); freopen("out.out", "w", stdout); int tc = 0; cin >> tc; for (int q = 0; q > n >> m; int start_point =..
차고 같은 경우, 무조건 작은 인덱스 차고부터 써야되니 자료형 vector를 이용해 역순으로 정렬해줘서 사용했다. 대기자 같은 경우, 큐 자료 구조를 이용하여 FIFO을 구현하였다. #include #include #include #include #include #include using namespace std; int car_box[101][2] = { 0 }; int car[2001][2] = { 0 }; queue stack; int price = 0; int n; int m; vector list; int fill(int index) { if (!list.empty()) { car[index][1] = list.back(); car_box[list.back()][1] = index; price ..
#include #include using namespace std; int main(void) { int tc = 0; cin >> tc; for (int i = 0; i > s_l; cin >> a; cin >> b; int count = 0; for (int j = 0; j < s_l; j++) { if (a[j] == b[j]) count++; } cout
Why should we hire you? Are you the best candidate for the job? Be prepared to explain why you're the applicant who should be hired. Make your response a confident, concise, focused, sales pitch that explains what you have to offer and why you should get the job. 니가 생각하는 최고의 강점을 표현하면 된다. 하지만, 여기서 주의할 점은 이 질문은 대부분 후반부에 나오는 질문이기에 앞에서 이 질문 전에 너의 강점을 많이 이야기 했을 수 있다. 그럴 경우, 앞에서 말했던 강점들을 포함하여 강점들을 짧고 ..
면접을 보다 보면 꼭 필요한 질문이 2가지 있다. 첫 번째로는 "잠시만 생각할 시간을 주시겠어요?"라는 질문이다. 면접 시, 당황한 질문을 받거나 답변을 생각하지 못한 질문을 받으면 그 때 필요한 스킬은 바로 "죄송하지만, 자시만 생각할 시간을 주시겠어요?"라는 질문이다. 이렇게 유용한 질문을 영어로는 뭐라고 할까? 그건 바로 "Could yout please give a moment" 이다. 여기서 please를 생략하지말자. 휠씬 정중한 표현이 된다. 두 번째로는 "다시 한번 말씀해주시겠어요?"라는 문장이다. 면접에서 긴장하다 보면 질문을 잘 이해하지 못하거나 잘 못들을 경우가 있다. 그때 이 문장을 사용하면 정중하면서도 매끄럽게 할 수 있다. 이 문장을 영어로 하면 무엇일까? 그건 바로 "Could..
나는 크루스칼 알고리즘으로 mst를 구현하였다. 하지만, 이 소스에서는 개선점이 있다. union-find 알고리즘을 사용해서 좀더 효율적으로 구현이 가능할 것 같다. #include #include using namespace std; #define MAX_NUM 100010 int input[MAX_NUM][3]; int num; int n = 0; int m = 0; void swap(int i ,int j) { int temp[3] = { input[i][0],input[i][1], input[i][2] }; input[i][0] = input[j][0]; input[i][1] = input[j][1]; input[i][2] = input[j][2]; input[j][0] = temp[0]; in..
정렬을 이용하여 단어를 정렬하는 문제였다. 정렬을 이용하는 가장 쉬운 문제였지만, 이 문제의 경우 퀵정렬을 사용할 경우 시간초과가 뜬다. 이에 유의해서 merge sort를 사용하였다. 시간은 딱맞았다. 하지만, merge sort의 경우, 배열을 2배를 사용했기에 공간효율이 좋지 못한 것 같다. -런타임에러 : 배열의 크기를 선언할 때, 0을 하나 누락했었다. - 시간초과 : 알고리즘을 수정하였다. quick -> merge sort로 #include #include using namespace std; string list[20001]; void swap(int i, int j) { string temp = list[i]; list[i] = list[j]; list[j] = temp; } int ch..
퀵 정렬은 평균적으로 O(nlogn)의 시간복잡도를 가지고 있다. 퀵 정렬은 기준의 되는 피봇을 설정하고 그것을 기준으로 값들을 swap하면서 sort 하는 것이다. #include #include using namespace std; int list[20] = { 0 }; void swap(int i, int j) { int temp = list[i]; list[i] = list[j]; list[j] = temp; } void quick_sort(int left, int right) { if (left > right)return; int pivot = right; int i = left; int j = right; while (i < j) { while (list[i] < list[pivot]) i++..