일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 우분투
- Kaggle
- AI 경진대회
- SW Expert Academy
- Baekjoon
- 프로그래머스
- 편스토랑 우승상품
- 맥북
- hackerrank
- PYTHON
- github
- dacon
- ubuntu
- 코로나19
- Git
- ChatGPT
- leetcode
- 캐치카페
- Real or Not? NLP with Disaster Tweets
- 파이썬
- 데이콘
- 더현대서울 맛집
- 자연어처리
- 백준
- programmers
- 금융문자분석경진대회
- 프로그래머스 파이썬
- gs25
- 편스토랑
- Docker
- Today
- Total
목록
반응형
Programming (1169)
솜씨좋은장씨
1일 1문제! 오늘의 문제는 백준의 나머지 입니다. 3052번: 나머지 각 수를 42로 나눈 나머지는 39, 40, 41, 0, 1, 2, 40, 41, 0, 1이다. 서로 다른 값은 6개가 있다. www.acmicpc.net Solution numList = [] for i in range(10): inputNum = int(input()) numList.append(inputNum % 42) print(len(set(numList))) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub. github.com
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 멀리뛰기 입니다. 코딩테스트 연습 - 멀리 뛰기 효진이는 멀리 뛰기를 연습하고 있습니다. 효진이는 한번에 1칸, 또는 2칸을 뛸 수 있습니다. 칸이 총 4개 있을 때, 효진이는 (1칸, 1칸, 1칸, 1칸) (1칸, 2칸, 1칸) (1칸, 1칸, 2칸) (2칸, 1칸, 1칸) (2칸, 2 programmers.co.kr Solution def solution(n): temp = dict() temp[0] = 1 temp[1] = 1 for i in range(2, n+1): temp[i] = temp[i-1] + temp[i-2] answer = temp[n] % 1234567 return answer SOMJANG/CODINGTEST_PRACTICE 1일..
1일 1문제! 오늘의 문제는 백준의 영화감독 숌 입니다! 1436번: 영화감독 숌 666은 종말을 나타내는 숫자라고 한다. 따라서, 많은 블록버스터 영화에서는 666이 들어간 제목을 많이 사용한다. 영화감독 숌은 세상의 종말 이라는 시리즈 영화의 감독이다. 조지 루카스는 스타 www.acmicpc.net Solution input_num = int(input()) answer = 666 while(input_num): if '666' in str(answer): input_num -= 1 answer += 1 print(answer-1) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 하샤드 수 입니다. 코딩테스트 연습 - 하샤드 수 양의 정수 x가 하샤드 수이려면 x의 자릿수의 합으로 x가 나누어져야 합니다. 예를 들어 18의 자릿수 합은 1+8=9이고, 18은 9로 나누어 떨어지므로 18은 하샤드 수입니다. 자연수 x를 입력받아 x가 하 programmers.co.kr Solution def solution(x): answer = True x_num_sum = sum([int(num) for num in list(str(x))]) if x % x_num_sum != 0: answer = False return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute..
코딩 1일 1문제! 오늘의 문제는 2018년도 카카오 블라인드 채용 문제였던 압축입니다! 코딩테스트 연습 - [3차] 압축 TOBEORNOTTOBEORTOBEORNOT [20, 15, 2, 5, 15, 18, 14, 15, 20, 27, 29, 31, 36, 30, 32, 34] programmers.co.kr Solution def solution(msg): answer = [] new_id = 27 word_dict = dict() for ascii_num in range(65, 91): word_dict[chr(ascii_num)] = ascii_num - 64 idx_f, idx_e = 0, 0 while True: idx_e += 1 if idx_e == len(msg): answer.appen..
코딩 1일 1문제! 오늘의 문제는 프로그래머스 월간 코드 챌린지 시즌1의 문제였던 내적입니다. [Programmers] 행렬의 덧셈 (Python) 코딩 1일 1문제 오늘의 문제는 프로그래머스 행렬의 덧셈 입니다. 코딩테스트 연습 - 행렬의 덧셈 행렬의 덧셈은 행과 열의 크기가 같은 두 행렬의 같은 행, 같은 열의 값을 서로 더한 결과가 됩 somjang.tistory.com Solution 1 def solution(a, b): answer = 0 for a_val, b_val in zip(a, b): answer += a_val * b_val return answer Solution 2 def solution(a, b): answer = 0 for i in range(len(a)): answer +=..
코딩 1일 1문제 오늘의 문제는 프로그래머스 행렬의 덧셈 입니다. 코딩테스트 연습 - 행렬의 덧셈 행렬의 덧셈은 행과 열의 크기가 같은 두 행렬의 같은 행, 같은 열의 값을 서로 더한 결과가 됩니다. 2개의 행렬 arr1과 arr2를 입력받아, 행렬 덧셈의 결과를 반환하는 함수, solution을 완성해주세요 programmers.co.kr Solution def solution(arr1, arr2): for row in range(len(arr1)): for col in range(len(arr1[row])): arr1[row][col] = arr1[row][col] + arr2[row][col] return arr1 SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.0..
코딩테스트 1일 1문제! 오늘의 문제는 2018년 카카오 블라인드 채용 문제였던 파일명 정렬입니다. 코딩테스트 연습 - [3차] 파일명 정렬 파일명 정렬 세 차례의 코딩 테스트와 두 차례의 면접이라는 기나긴 블라인드 공채를 무사히 통과해 카카오에 입사한 무지는 파일 저장소 서버 관리를 맡게 되었다. 저장소 서버에는 프로그램 programmers.co.kr Solution import re def solution(files): answer = [] head_num_tail = [re.split(r"([0-9]+)", file) for file in files] sorted_head_num_tail = sorted(head_num_tail, key=lambda x: (x[0].lower(), int(x[1]..
코딩테스트 1일 1문제! 오늘의 문제는 프로그래머스의 3진법 뒤집기 입니다. 코딩테스트 연습 - 3진법 뒤집기 자연수 n이 매개변수로 주어집니다. n을 3진법 상에서 앞뒤로 뒤집은 후, 이를 다시 10진법으로 표현한 수를 return 하도록 solution 함수를 완성해주세요. 제한사항 n은 1 이상 100,000,000 이하인 자연수 programmers.co.kr Solution def solution(n): answer = 0 ternary = "" while n > 0: n, mod = divmod(n, 3) ternary = ternary + str(mod) answer = int(ternary, 3) return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 sin..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 이진변환 반복하기 입니다. 코딩테스트 연습 - 이진 변환 반복하기 programmers.co.kr Solution def solution(x): answer = [] cnt = 0 zero = 0 while True: if x == '1': break zero = zero + x.count("0") x = x.replace("0", "") x = bin(len(x))[2:] cnt = cnt + 1 answer = [cnt, zero] return answer Solution 풀이 먼저 삭제한 0의 개수를 저장할 zero라는 변수명과 이진변환을 수행한 횟수를 나타낼 cnt 변수 두개를 선언합니다. while 반복문을 도는데 x가 '1' 이 되면 멈추는 조건..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 콜라츠 추측입니다. 코딩테스트 연습 - 콜라츠 추측 1937년 Collatz란 사람에 의해 제기된 이 추측은, 주어진 수가 1이 될때까지 다음 작업을 반복하면, 모든 수를 1로 만들 수 있다는 추측입니다. 작업은 다음과 같습니다. 1-1. 입력된 수가 짝수라면 2 programmers.co.kr Solution def solution(num): answer = 0 while True: if num == 1: break if answer > 499: answer = -1 break if num % 2 == 0: num = num / 2 elif num % 2 == 1: num = num * 3 + 1 answer = answer + 1 return answe..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 같은 숫자는 싫어 입니다. 코딩테스트 연습 - 같은 숫자는 싫어 배열 arr가 주어집니다. 배열 arr의 각 원소는 숫자 0부터 9까지로 이루어져 있습니다. 이때, 배열 arr에서 연속적으로 나타나는 숫자는 하나만 남기고 전부 제거하려고 합니다. 단, 제거된 후 남은 programmers.co.kr Solution def solution(arr): answer = [] before_num = arr[0] answer.append(before_num) for i in range(1, len(arr)): if before_num != arr[i]: answer.append(arr[i]) before_num = arr[i] return answer SOMJANG..
코딩 1일 1문제! 오늘의 문제는 문자열 내 마음대로 정렬하기 입니다. 코딩테스트 연습 - 문자열 내 마음대로 정렬하기 문자열로 구성된 리스트 strings와, 정수 n이 주어졌을 때, 각 문자열의 인덱스 n번째 글자를 기준으로 오름차순 정렬하려 합니다. 예를 들어 strings가 [sun, bed, car]이고 n이 1이면 각 단어의 인덱스 1 programmers.co.kr Solution def solution(strings, n): answer = [] strings = sorted(strings) answer = sorted(strings, key=lambda x: x[n]) return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. ..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 문자열 다루기 기본입니다. 코딩테스트 연습 - 문자열 다루기 기본 문자열 s의 길이가 4 혹은 6이고, 숫자로만 구성돼있는지 확인해주는 함수, solution을 완성하세요. 예를 들어 s가 a234이면 False를 리턴하고 1234라면 True를 리턴하면 됩니다. 제한 사항 s는 길이 1 이 programmers.co.kr Solution 1 import re def solution(s): answer = False re_s = re.sub("[0-9]",'',s) if re_s == '': if len(s) in [4, 6]: answer = True return answer Solution 1 풀이 문자열의 길이가 4또는 6이고 숫자로만 구성되어있는지 ..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 2019 카카오 블라인드 채용 문제였던 실패율 입니다. 코딩테스트 연습 - 실패율 실패율 슈퍼 게임 개발자 오렐리는 큰 고민에 빠졌다. 그녀가 만든 프랜즈 오천성이 대성공을 거뒀지만, 요즘 신규 사용자의 수가 급감한 것이다. 원인은 신규 사용자와 기존 사용자 사이에 스 programmers.co.kr Solution def solution(N, stages): answer = [] fail_percent = {} num_of_people = len(stages) for i in range(1, N+1): count = stages.count(i) if num_of_people == 0: fail_percent[i] = 0 else: fail_percent[..
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 2021 카카오 블라인드 채용 문제였던 신규 아이디 추천 입니다. 코딩테스트 연습 - 신규 아이디 추천 카카오에 입사한 신입 개발자 네오는 카카오계정개발팀에 배치되어, 카카오 서비스에 가입하는 유저들의 아이디를 생성하는 업무를 담당하게 되었습니다. 네오에게 주어진 첫 업무는 새로 가 programmers.co.kr Solution import re def solution(new_id): answer = '' answer = new_id.lower() answer = re.sub('[^a-z0-9\-\_\.]', '', answer) answer = re.sub('\.{2,}', '.', answer) answer = re.sub('^\.|\.$', '', ..
Given the pointer to the head node of a doubly linked list, reverse the order of the nodes in place. That is, change the next and prev pointers of the nodes so that the direction of the list is reversed. Return a reference to the head node of the reversed list. Note: The head node might be NULL to indicate that the list is empty. Function Description Complete the reverse function in the editor b..
Given the pointer to the head node of a linked list and an integer to insert at a certain position, create a new node with the given integer as its data attribute, insert this node at the desired position and return the head node. A position of 0 indicates head, a position of 1 indicates one node away from the head and so on. The head pointer given may be null meaning that the initial list is em..
1일 1문제 314일차! 오늘의 문제는 프로그래머스의 가운데 글자 가져오기 입니다. 코딩테스트 연습 - 가운데 글자 가져오기 단어 s의 가운데 글자를 반환하는 함수, solution을 만들어 보세요. 단어의 길이가 짝수라면 가운데 두글자를 반환하면 됩니다. 재한사항 s는 길이가 1 이상, 100이하인 스트링입니다. 입출력 예 s ret programmers.co.kr Solution def solution(s): answer = '' center = len(s) // 2 if len(s) % 2 == 0: answer = s[center-1:center+1] else: answer = s[center] return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 20..
1일 1문제 313일차! 오늘의 문제는 프로그래머스의 나누어 떨어지는 숫자 배열 입니다. 코딩테스트 연습 - 나누어 떨어지는 숫자 배열 array의 각 element 중 divisor로 나누어 떨어지는 값을 오름차순으로 정렬한 배열을 반환하는 함수, solution을 작성해주세요. divisor로 나누어 떨어지는 element가 하나도 없다면 배열에 -1을 담아 반환하 programmers.co.kr Solution def solution(arr, divisor): answer = [num for num in arr if num % divisor == 0] if len(answer) > 0: answer = sorted(answer) else: answer = [-1] return answer SOMJA..
ubuntu18.04 베이스 이미지에 python3.6을 설치한 도커 이미지에서 opencv ( opencv-python )를 설치하고 실행을 하려고 하니 ImportError: libGL.so.1: cannot open shared object file: No such file or directory 위와 같은 오류가 발생하게 되었습니다. 이는 도커 이미지를 생성할때 apt-get을 활용하여 libgl1-mesa-glx라는 것을 설치해주면 해결이 가능합니다. 이를 설치하기 위해서는 이미지를 build 할때 활용하는 Dockerfile안에 설치하는 구문을 추가해주면 됩니다. Dockerfile ~~~~ 생략 RUN apt-get update RUN apt-get -y install libgl1-mesa-..
You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. Example 1: Input: s = "abcd", t = "abcde" Output: "e" Explanation: 'e' is the letter that was added. Example 2: Input: s = "", t = "y" Output: "y" Example 3: Input: s = "a", t = "aa" Output: "a" Example 4: Input: s = "ae",..
A peak element is an element that is strictly greater than its neighbors. Given an integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine that nums[-1] = nums[n] = -∞. Example 1: Input: nums = [1,2,3,1] Output: 2 Explanation: 3 is a peak element and your function should return the index number 2. ..
ES를 활용하여 개발을 하다보면 Kibana가 설치되어있을때는 인덱스 조회, 검색 테스트 등을 UI를 통해 쉽게 진행할 수 있으나 Kibana가 설치되어있지 않거나 사용이 제한될 경우에는 터미널에서 명령어를 통해 조작을 해야하는 경우가 종종 있었습니다. 이번 글에서는 터미널에서 명령어를 통하여 인덱스를 다루는 방법들에 대해서 적어보려합니다. 설치된 곳은 localhost, 포트는 9200번이라고 가정하였습니다. 서버 IP와 포트가 다른 경우 [ localhost:9200 ] 부분을 변경하시어 사용하시기 바랍니다. 대부분의 명령어에서 curl을 활용하므로 curl이 설치되어있지 않은 경우 설치 후 진행하시기 바랍니다. 인덱스 목록 조회 $ curl -XGET localhost:9200/_cat/indice..
You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane. Example 1: Input: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] Output: true Example 2: Input: coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]] Output: false Constraints: 2
Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11 as "1011" in binary, and so on. Note that except for N = 0, there are no leading zeroes in any binary representation. The complement of a binary representation is the number in binary you get when changing every 1 to a 0 and 0 to a 1. For example, the complement of "101" in binary i..
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity. Example 1: Input: 1->2->3->4->5->NULL Output: 1->3->5->2->4->NULL Example 2: Input: 2->1->3->5->6->4->7->NULL Outpu..
Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 arr[i + 1] > ... > arr[arr.length - 1] Example 1: Input: arr = [2,1] Output: false Example 2: Input: arr = [3,5,5] Output: false ..
Given an integer n and an integer start. Define an array nums where nums[i] = start + 2*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. Example 1: Input: n = 5, start = 0 Output: 8 Explanation: Array nums is equal to [0, 2, 4, 6, 8] where (0 ^ 2 ^ 4 ^ 6 ^ 8) = 8. Where "^" corresponds to bitwise XOR operator. Example 2: Input: n = 4, start = 3 Output: 8 Explan..
Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary representation. Example 1: Input: num = 5 Output: 2 Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2. Example 2: Input: num = 1 Output: 0 Explanation: The binary representation of 1 is 1 (no leading zero..