전체 글

전체 글

    LG전자 모의 인성검사 후기 (+ LG Way Fit Test 후기)

    LG전자 모의 인성검사 후기 (+ LG Way Fit Test 후기)

    오늘 오후 1시에 LG전자 인적성 검사가 있다. LG전자는 인적성에서 적성보다 인성이 중요하다고 하는데 적성만 공부하고 인성은 유형도 잘 몰라서 불안함 급습..! 당일 새벽인데 갑자기 부랴부랴 잡플랫에서 제공하는 모의 인성검사를 해봤다. (유료) 시험 보고 합불 결과 나오면 다시 후기를 수정하겠지만, 시험 보기 전인 지금은 일단 추천! 어느정도로 고르면 내가 솔직하고 바람직한 방향으로 잘 선택한건지 대략적으로 알 수 있어서 좋았다. 그리고 미리 실제 응시 환경에 대비해보기에 괜찮은 듯ㅎ 유일한 단점이라면, 문제수가 465문항이나 돼서 새벽에 풀다가는 정신이 점점 아득해져온다... 총 80분 동안 보게끔 하니까 정신이 맑을 때 해보는 게 좋을 것 같다. (실제 LG 인성 검사는 20분에 183개!) 모의 ..

    [프로그래머스/C++] 올바른 괄호

    [프로그래머스/C++] 올바른 괄호

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/12909 🎖️난이도 Level 2 ✔️풀이 #include #include //#include => 스택은 벡터로 구현하는게 더 접근 쉬움! #include using namespace std; bool solution(string s) { if (s[0] == ')') return false; vector stack; // string 아니고 char (문자 기호) for (int i = 0; i < s.length(); i++) { if (s[i] == '(') { stack.push_back(s[i]); continue; } if (!stack.empty()) { // "())" 의 경우..

    [프로그래머스/C++] 숫자 문자열과 영단어

    [프로그래머스/C++] 숫자 문자열과 영단어

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/81301 🎖️난이도 Level 1 ✔️풀이 // sol1) map(dict), isdigit, substr 이용 #include #include #include #include #include using namespace std; int solution1(string s) { map m; m["zero"] = "0"; m["one"] = "1"; m["two"] = "2"; m["three"] = "3"; m["four"] = "4"; m["five"] = "5"; m["six"] = "6"; m["seven"] = "7"; m["eight"] = "8"; m["nine"] = "9"; int..

    [프로그래머스/C++] 소수 찾기

    [프로그래머스/C++] 소수 찾기

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/12921 🎖️난이도 Level 1 ✔️풀이 // 정답 #include #include #include #include using namespace std; int solution(int n) { int cnt = 0; //bool arr[1000001] = {true}; // 이렇게 하면 첫번째 값만 true로 초기화됨! (나머지는 false) //arr[0] = arr[1] = false; // 0과 1은 소수 x // 배열 초기화 (sol1) /* bool arr[1000001]; for(int i = 2; i 조금 더 느림 // 에라토스테네스의 체 => 배수들(소수가 아닌 애들)을 0으로..

    [프로그래머스/C++] 폰켓몬

    [프로그래머스/C++] 폰켓몬

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/1845 🎖️난이도 Level 1 ✔️풀이 // 정답 #include #include #include using namespace std; int solution(vector nums) { int N = nums.size(); set s(nums.begin(), nums.end()); return N / 2 > s.size() ? s.size() : N / 2; } // 오답 (시간초과) => 순열과 조합 다 구할 필요 X #include #include #include #include // next_permutation(순열), 조합 using namespace std; int solution..

    [프로그래머스/C++] 2016년

    [프로그래머스/C++] 2016년

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/12901 🎖️난이도 Level 1 ✔️풀이 #include #include #include using namespace std; string solution(int a, int b) { vector days = { 31,29,31,30,31,30,31,31,30,31,30,31 }; vector date = { "FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU" }; /* int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31}; string date[7] = {"FRI", "SAT", "SUN", "MON", "TUE",..

    [프로그래머스] 교점에 별 만들기

    [프로그래머스] 교점에 별 만들기

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/87377 🎖️난이도 Level 2 ✔️풀이 from itertools import combinations def solution(line): # 모든 교점 중 정수쌍 구하기 intersections = set() for comb in combinations(line, 2): a,b,e = comb[0] c,d,f = comb[1] if a*d == b*c : continue x = (b*f-e*d) / (a*d-b*c) y = (e*c-a*f) / (a*d-b*c) if x == int(x) and y == int(y): intersections.add((int(x), int(y))) # 여기..

    [프로그래머스] 스킬트리

    [프로그래머스] 스킬트리

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/49993 🎖️난이도 Level 2 ✔️풀이 def solution(skill, skill_trees): cnt = 0 for tree in skill_trees: idx = 0 for i in range(len(tree)): if tree[i] not in skill: continue elif tree[i] == skill[idx]: idx += 1 else: cnt -= 1 break cnt += 1 return cnt 🧠노트 - 🔍참고 -

    [기타] 마스크 연산같은 다이아몬드 배열 구현

    [기타] 마스크 연산같은 다이아몬드 배열 구현

    방금 라인 코딩테스트 때는 결국 못 풀고 뒤늦게 깨달은 풀이 아이디어 기록.. 문제는 공개할 수 없지만 다음에 풀 때에는 대충 요런 식으로 풀자! 💡Tip : "거리"를 이용하자! (abs를 통한 |x 거리 차이| & |y 거리 차이| 계산) # 네모 (정방형) 연산 for i in range(n): for j in range(n): if i in range(x-m, x+m+1) and j in range(y-m, y+m+1): graph[i][j] += (m+1) - max(abs(x - i), abs(y - j)) # 다이아몬드 연산 for i in range(n): for j in range(n): if abs(x - i) + abs(y - j) 2->1) 기준은 중심 값(m+1 즉, 반지름) 기준..

    [프로그래머스] N으로 표현

    [프로그래머스] N으로 표현

    📌문제 https://school.programmers.co.kr/learn/courses/30/lessons/42895 🎖️난이도 Level 3 ✔️풀이 # 정답 (DP, Brute Force) def solution(N, number): if N == number: return 1 # 마지막 테스트 케이스 주의! (같으면 연산자 X) set_list = [set([int(str(N)*(i+1))]) for i in range(8)] for i in range(1, 8): for j in range(i): # 두 set의 product => 사칙연산 수행 for num1 in set_list[j]: for num2 in set_list[i-j-1]: set_list[i].add(num1 + num2) ..