일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 금융문자분석경진대회
- 데이콘
- 편스토랑
- SW Expert Academy
- 맥북
- 백준
- 코로나19
- Baekjoon
- Kaggle
- github
- gs25
- programmers
- ubuntu
- Real or Not? NLP with Disaster Tweets
- 더현대서울 맛집
- 편스토랑 우승상품
- ChatGPT
- Git
- AI 경진대회
- leetcode
- 프로그래머스 파이썬
- PYTHON
- dacon
- 우분투
- hackerrank
- Docker
- 캐치카페
- 프로그래머스
- 파이썬
- 자연어처리
- Today
- Total
목록
반응형
2021/02 (17)
솜씨좋은장씨
코딩 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..
개발을 하다가 종종 현재 개발하고 있는 위치의 git 설정을 다시 설정하고 싶은 경우가 있을 수 있습니다. 이번 글에서는 기존에 설정한 git init 을 해제하고 새로 설정하는 방법에 대해서 적어보려 합니다. 먼저 기존에 git init을 했던 디렉토리라면 .git 이라는 숨겨진 파일이 있을겁니다. $ rm -rf .git 먼저 해당 파일을 삭제합니다. 그러면 기존에 설정해 두었던 설정들이 지워집니다. (base) SOMJANGui-MacBookPro:test donghyunjang$ git status fatal: not a git repository (or any of the parent directories): .git $ git status git status 명령어를 통해서 제대로 해제가 되었..
코딩 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