일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- ChatGPT
- 백준
- 프로그래머스 파이썬
- AI 경진대회
- 파이썬
- Docker
- 편스토랑
- Git
- 자연어처리
- 우분투
- 코로나19
- Real or Not? NLP with Disaster Tweets
- 금융문자분석경진대회
- ubuntu
- gs25
- 편스토랑 우승상품
- SW Expert Academy
- Baekjoon
- 더현대서울 맛집
- PYTHON
- hackerrank
- 프로그래머스
- dacon
- leetcode
- 데이콘
- 캐치카페
- github
- 맥북
- Kaggle
- programmers
- Today
- Total
목록
반응형
분류 전체보기 (1651)
솜씨좋은장씨
yarn 패키지를 설치한 이후 부터 터미널을 시작할 때마다 Last login: Thu Jul 16 10:36:16 on ttys000 error Command "gobal" not found. 항상 Last login ~~ 메세지 아래 error Command "gobal" not found. 라는 에러메세지가 출력되면서 터미널이 바로 시작하지 않고 잠시 지연되었다가 실행되는 현상이 있었습니다. 열심히 에러메세지를 검색해봤지만 별다른 소득을 얻지 못하고 있던 그때! [macOS] 터미널에서 command not found가 계속 뜰 때… 맥 터미널에서 특정 패키지를 설치하고나서 PATH가 설정된 뒤, 어떠한 명령어를 쳐도 command not found가 뜰 때가 있다. medium.com 위의 블로그..
Ubuntu(Linux)에서 코딩을 하다보면 자주 vi 편집기를 활용하게 됩니다. 그러다가 보면 몇번째 라인에서 에러가 발생했는데 줄번호가 없어서 확인하기 어려울 때가 있습니다. 활성화 방법 vi 편집기에서 esc를 누른 후 :set number 를 입력하고 엔터를 입력해주면 됩니다. 해제 방법 해제하는 방법은 동일하게 esc를 누르고 :set nonumber 를 입력한 후 엔터를 입력해주면 됩니다. 항상 설정해두는 방법 먼저 홈 디렉토리로 이동합니다. $ cd ~ 그 다음 vimrc 파일을 열어 set number 를 입력합니다. $ vi .vimrc set number를 입력한 후 esc를 누르고 :wq를 입력하여 저장합니다. 이제 제대로 설정되었는지 확인해보면 별도의 :set number 설정 없이..
우분투(리눅스)에서 특정 파일을 다른 파일로 복사를 하고 싶을 때 cp 명령어를 사용합니다. $ cp [원본파일 위치] [복사하고자 하는 위치] 그런데 가끔 cp: omitting directory 디렉토리명 위와 같은 오류 메세지가 나오는 경우가 있습니다. 그럴 경우에는 cp 명령어 뒤에 -r 옵션을 붙여주면 오류가 나지 않고 정상적으로 실행이 되는 것을 볼 수 있습니다. $ cp -r [원본파일 위치] [복사하고자 하는 위치] 읽어주셔서 감사합니다!
Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array. Example 1: Input: a = 2, b = [3] Output: 8 Example 2: Input: a = 2, b = [1,0] Output: 1024 Solution class Solution: def superPow(self, a: int, b: List[int]) -> int: answer = 1 for b_val in b[::-1]: answer = answer * a ** b_val % 1337 a = pow(a, 10) % 133..
자바스크립트에서 배열의 앞뒤에 데이터를 추가하는 방법입니다. 다음과 같이 배열 하나가 생성되어있을때 var myArray = [] 배열의 앞에 데이터를 추가하는 방법 myArray.unshift(추가할 항목); 배열의 가장 뒤에 데이터를 추가하는 방법 myArray.push(추가할 항목); 이렇게 unshift와 push를 이용하여 데이터를 추가할 수 있습니다. 반대로 삭제하는 방법은 다음과 같습니다. 배열의 앞의 데이터를 삭제하는 방법 myArray.shift(); 배열의 뒤의 데이터를 삭제하는 방법 myArray.pop();
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example 1: Input: a = 1, b = 2 Output: 3 Example 2: Input: a = -2, b = 3 Output: 1 Solution class Solution: def getSum(self, a: int, b: int) -> int: answer = sum([a, b]) return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating..
멀티 캠퍼스에서 정부지원 교육을 수료할 당시에 AWS GPU 서버를 지원받아서 사용하다가 수료 이후 서버 지원이 종료되어 그동안에는 구글에서 제공해주고 있는 Colab 을 열심히 사용하였습니다. 물론 무료에 P100과 같이 제가 돈을 주고 사기에는 너무 값이 비싼 GPU 자원을 사용할 수 있다는 점은 매우 감사했지만 학습을 시작하고 별도의 조작이 없을 경우 연결이 해제되거나 그동안 학습되었던 내용이 다 사라지는 슬픈 경우들이 존재했습니다. 그러던 중! AI Hub 에서 일반 개인 학습자(예비 창업자 등)도 신청하여 사용할 수 있는 AI 컴퓨팅 수시 사용자 신청이 있다는 것을 알게되었고! 신청을 해보았습니다. 수시 사용자가 신청하여 사용가능한 자원의 스펙 생각보다 신청하는데 큰 어려움이 없이 정말 간단하게..
nipa에서 GPU 서버를 지원받고 KorQuAD 1.0을 시도해보면서 얼마나 GPU를 사용하는지 보기위해서 $ nvidia-smi 명령어를 계속 입력하다가 쉘스크립트를 통해 1초에 1번씩 업데이트를 하도록 할 수 있지 않을까? 하여 찾아보니 원하는 시간 마다 반복하여 명령어를 수행하는 방법이 있었습니다. while true; do nvidia-smi; sleep 1; clear; done 위의 명령어를 사용하면 1초에 한번 씩 nvidia-smi 명령 실행 후 터미널의 화면을 한번 지웠다 다시 nvidia-smi 명령을 실행합니다. nvidia-smi 이외에 다른 명령어를 n초마다 반복하여 실행을 원한다면 다음과 같이 작성하면 됩니다. while true; do 실행을 희망하는 명령어; sleep 반복..
우분투 서버 사용 시 비밀번호 변경 방법입니다. $ passwd 위의 명령어를 활용하여 비밀번호 변경 절차를 실시합니다. Changing password for ubuntu. (current) UNIX password: New password: Retype new password: passwd: password updated successfully 현재의 비밀번호를 한번 입력한 뒤 새로 변경할 비밀번호를 두번 입력 (새 비밀번호 입력/확인을 위한 재입력) 해주면 변경 완료입니다. 읽어주셔서 감사합니다!
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. Solution class Solution: def twoSum(self, nums: List[int], target: int) -> List[..
Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false Solution class Solution: def isPowerOfTwo(self, n: int) -> bool: answer = False pow_2s = [] for i in range(50): pow_2s.append(pow(2, i)) if n in pow_2s: answer = True return answer ..
For a non-negative integer X, the array-form of X is an array of its digits in left to right order. For example, if X = 1231, then the array form is [1,2,3,1]. Given the array-form A of a non-negative integer X, return the array-form of the integer X+K. Example 1: Input: A = [1,2,0,0], K = 34 Output: [1,2,3,4] Explanation: 1200 + 34 = 1234 Example 2: Input: A = [2,7,4], K = 181 Output: [4,5,5] E..
The absolute difference between two integers, a and b, is written as |a - b|. The maximum absolute difference between two integers in a set of positive integers, elements, is the largest absolute difference between any two integers in elements. The Difference class is started for you in the editor. It has a private integer array (elements) for storing N non-negative integers, and a public intege..
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount..
1일 1문제 153일차! 153일차의 문제는 백준의 1, 2, 3 더하기 입니다. 9095번: 1, 2, 3 더하기 문제 정수 4를 1, 2, 3의 합으로 나타내는 방법은 총 7가지가 있다. 합을 나타낼 때는 수를 1개 이상 사용해야 한다. 1+1+1+1 1+1+2 1+2+1 2+1+1 2+2 1+3 3+1 정수 n이 주어졌을 때, n을 1, 2, 3의 합으로 나타내는 www.acmicpc.net Solution loopN = int(input()) answers = [] for i in range(loopN): inputNum = int(input()) if inputNum == 1: answers.append(1) elif inputNum == 2: answers.append(2) elif input..
이 글은 새로운 방법을 알게 될 때 마다 계속 업데이트 할 예정입니다. 우리는 종종 별도의 설정없이 matplotlib으로 한글이 들어간 그래프를 그리고자 할때 아래와 같이 한국어가 ㅁ로 깨져서 나오는 것을 볼 수 있습니다. 이 글에서는 위처럼 matplotlib 활용 시 한글이 깨져나올 때 해결하는 방법에 대해서 적어보려 합니다. Mac OSX 1. matplotlib의 rcParams를 통해 전역 폰트 설정하기 먼저 matplotlib의 rcParams를 통해 전역 폰트를 설정해주는 방법입니다. 별도의 폰트 설치 없이도 가장 쉽게 설정할 수 있는 방법입니다. import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['axes.unic..
1일 1문제 152일차! 오늘의 문제는 백준의 알파벳 개수입니다. 10808번: 알파벳 개수 단어에 포함되어 있는 a의 개수, b의 개수, …, z의 개수를 공백으로 구분해서 출력한다. www.acmicpc.net Solution word_s = input() word_count_dic = {'a':0, 'b':0, 'c':0, 'd':0, 'e':0, 'f':0, 'g':0, 'h':0, 'i':0, 'j':0, 'k':0, 'l':0, 'm':0, 'n':0, 'o':0, 'p':0, 'q':0, 'r':0, 's':0, 't':0, 'u':0, 'v':0, 'w':0, 'x':0, 'y':0, 'z':0} index = ['a','b','c', 'd', 'e', 'f', 'g', 'h', 'i', ..
1일 1문제 151일차! 오늘의 문제는 알파벳 찾기 입니다. 10809번: 알파벳 찾기 각각의 알파벳에 대해서, a가 처음 등장하는 위치, b가 처음 등장하는 위치, ... z가 처음 등장하는 위치를 공백으로 구분해서 출력한다. 만약, 어떤 알파벳이 단어에 포함되어 있지 않다면 -1을 출 www.acmicpc.net Solution word_s = input() word_count_dic = {'a':0, 'b':0, 'c':0, 'd':0, 'e':0, 'f':0, 'g':0, 'h':0, 'i':0, 'j':0, 'k':0, 'l':0, 'm':0, 'n':0, 'o':0, 'p':0, 'q':0, 'r':0, 's':0, 't':0, 'u':0, 'v':0, 'w':0, 'x':0, 'y':0, '..
1일 1문제 150일차! 150일차의 문제는 백준의 2진수 8진수 입니다. 1373번: 2진수 8진수 첫째 줄에 2진수가 주어진다. 주어지는 수의 길이는 1,000,000을 넘지 않는다. www.acmicpc.net Solution print(oct(int(input(), 2))[2:]) 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문제 149일차! 149일차의 문제는 최소공배수 입니다. 1934번: 최소공배수 두 자연수 A와 B에 대해서, A의 배수이면서 B의 배수인 자연수를 A와 B의 공배수라고 한다. 이런 공배수 중에서 가장 작은 수를 최소공배수라고 한다. 예를 들어, 6과 15의 공배수는 30, 60, 90등이 있� www.acmicpc.net Solution def gcd(a, b): mod = a%b while mod > 0: a = b b = mod mod = a%b return b def lcm(a, b): return a*b//gcd(a,b) loopNum = int(input()) for i in range(loopNum): inputNums = input() inputNums = inputNums.spli..
1일 1문제 148일차! 148일차의 문제는 최대공약수와 최소공배수 입니다. 2609번: 최대공약수와 최소공배수 첫째 줄에는 입력으로 주어진 두 수의 최대공약수를, 둘째 줄에는 입력으로 주어진 두 수의 최소 공배수를 출력한다. www.acmicpc.net Solution inputNums = input() inputNums = inputNums.split() a = int(inputNums[0]) b = int(inputNums[1]) def gcd(a, b): mod = a%b while mod > 0: a = b b = mod mod = a%b return b def lcm(a, b): return a*b//gcd(a,b) print(gcd(a, b)) print(lcm(a, b)) SOMJANG/C..
1일 1문제 147일차! 147일차의 문제는 백준의 나머지 입니다. 10430번: 나머지 첫째 줄에 A, B, C가 순서대로 주어진다. (2 ≤ A, B, C ≤ 10000) www.acmicpc.net Solution a,b,c= map(int, input().split()) print((a+b)%c) print((a%c + b%c)%c) print((a*b)%c) print((a%c * b%c)%c) 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문제 146일차! 오늘은 쉬어가는 타임! 백준의 8진수 2진수 입니다. 1212번: 8진수 2진수 첫째 줄에 8진수가 주어진다. 주어지는 수의 길이는 333,334을 넘지 않는다. www.acmicpc.net Solution print(bin(int(input(), 8))[2:]) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub. github.com
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die. Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty), and a number n, return if n new flowers can be planted in it without violating the no-adjacent-f..
1일 1문제 144일차! 오늘의 문제는 Base Conversion입니다. 11576번: Base Conversion 타임머신을 개발하는 정이는 오랜 노력 끝에 타임머신을 개발하는데 성공하였다. 미래가 궁금한 정이는 자신이 개발한 타임머신을 이용하여 500년 후의 세계로 여행을 떠나게 되었다. 500년 후의 www.acmicpc.net Solution A, B = map(int, input().split()) m = int(input()) num = list(map(int, input().split())) result = [] n = 0 for i in range(len(num)): n = n + (num.pop() * (A**i)) while n: result.append(n%B) n //= B whi..
MNIST 데이터를 활용하여 손글씨 분류를 해보기 위해서 Tensorflow 2.0을 활용하여 모델을 만들고 model.fit을 실행하였는데 ValueError: Shapes (32, 10) and (32, 1) are incompatible 위와 같은 에러가 발생하였습니다. 처음에는 데이터 전처리를 잘못한 것으로 생각하다가 아무리 봐도 데이터 전처리에 있어서는 문제가 없어 보여서 찾아보니 sparse_categorical_crossentropy를 loss사용하여 model을 compile할 때 metrics 에서 충돌이 일어나 발생하는 문제였습니다. 해결 방법은 아래와 같습니다. 에러가 발생하던 compile 방법 model.compile(optimizer=tf.keras.optimizers.Adam(..
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. Example 1: Input: [1,3,4,2,2] Output: 2 Example 2: Input: [3,1,3,4,2] Output: 3 Note: You must not modify the array (assume the array is read only). You must use only constant,..
1일 1문제 142일차! 142일차의 문제는 진법 변환 2입니다. 11005번: 진법 변환 2 10진법 수 N이 주어진다. 이 수를 B진법으로 바꿔 출력하는 프로그램을 작성하시오. 10진법을 넘어가는 진법은 숫자로 표시할 수 없는 자리가 있다. 이런 경우에는 다음과 같이 알파벳 대문자를 �� www.acmicpc.net Solution B_jinbub_dic = { 0:'0', 1:'1', 2:'2', 3:'3', 4:'4', 5:'5', 6:'6', 7:'7', 8:'8', 9:'9', 10:'A', 11:'B', 12:'C', 13:'D', 14:'E', 15:'F', 16:'G', 17:'H', 18:'I', 19:'J', 20:'K', 21:'L', 22:'M', 23:'N', 24:'O', 25..
1일 1문제 141일차! 141일차의 문제는 백준의 가장 큰 증가 부분 수열입니다. 11055번: 가장 큰 증가 부분 수열 수열 A가 주어졌을 때, 그 수열의 증가 부분 수열 중에서 합이 가장 큰 것을 구하는 프로그램을 작성하시오. 예를 들어, 수열 A = {1, 100, 2, 50, 60, 3, 5, 6, 7, 8} 인 경우에 합이 가장 큰 증가 부분 수� www.acmicpc.net Solution inputNum = int(input()) inputNums = input() inputNums = inputNums.split() inputNums = [int(num) for num in inputNums] nc = [0] * (inputNum) maxNum = 0 for i in range(0, in..
1일 1문제 140일차! 140일차의 문제는 백준의 가장 긴 바이토닉 부분 수열 입니다. 11054번: 가장 긴 바이토닉 부분 수열 첫째 줄에 수열 A의 크기 N이 주어지고, 둘째 줄에는 수열 A를 이루고 있는 Ai가 주어진다. (1 ≤ N ≤ 1,000, 1 ≤ Ai ≤ 1,000) www.acmicpc.net Solution import sys r = lambda : sys.stdin.readline() def _get_seq_len(a): dp = [1 for _ in range(len(a))] rev_dp = [1 for _ in range(len(a))] for i in range(len(a)): dp[i] = 1 for j in range(i, -1, -1): if a[i] > a[j] and..