일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 데이콘
- 자연어처리
- Real or Not? NLP with Disaster Tweets
- hackerrank
- PYTHON
- 백준
- 맥북
- Baekjoon
- dacon
- programmers
- gs25
- 더현대서울 맛집
- 프로그래머스
- Docker
- leetcode
- ChatGPT
- 편스토랑 우승상품
- 우분투
- ubuntu
- 파이썬
- 금융문자분석경진대회
- Git
- AI 경진대회
- 편스토랑
- 프로그래머스 파이썬
- github
- Kaggle
- 캐치카페
- 코로나19
- SW Expert Academy
- Today
- Total
목록
반응형
2020/07 (46)
솜씨좋은장씨
We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists only of lowercase letters.) A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence. Return a list of all uncommon words. You may return the list in any order. Example 1: Input: A = "this apple is sweet", B = "this apple is sour" Output..
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [9,4] Note: Each element in the result must be unique. The result can be in any order. Solution class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: return list(set(nums1..
Example 3: Given a date, return the corresponding day of the week for that date. The input is given as three integers representing the day, month and year respectively. Return the answer as one of the following values {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}. Example 1: Input: day = 31, month = 8, year = 2019 Output: "Saturday" Example 2: Input: day = 18, mo..
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. Example: Input: [1,2,1,3,2,5] Output: [3,5] Note: The order of the result is not important. So in the above example, [5, 3] is also correct. Your algorithm should run in linear runtime complexity. Could you implement it using..
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Follow up: What if you cannot modify the input lists? In other words, reversing the li..
AWS의 리눅스 서버에서 selenium을 사용하기 위하여 google-chrome-stable을 설치하려고 하니 현재 설치하려고하는 서버에서는 apt 패키지가 아닌 yum 패키지를 사용하여 이전에 우분투에서 설치했던 방법을 적용하려고하니 적용을 할 수 없었습니다. yum 패키지를 활용하여 설치하는 방법에 대해서 정리해보려고 합니다. 먼저 repo 파일을 하나 생성합니다. $ sudo vi /etc/yum.repos.d/google-chrome/repo 이 때 sudo 권한을 부여하지 않으면 아래와 같이 오류가 발생 할 수 도 있으니 "/etc/yum.repos.d/google-chrome.repo" E212: 쓸 파일을 열 수 없습니다 꼭 sudo를 앞에 붙이시는 것을 추천드립니다. 생성하였으면 그 안..
Write a program to count the number of days between two dates. The two dates are given as strings, their format is YYYY-MM-DD as shown in the examples. Example 1: Input: date1 = "2019-06-29", date2 = "2019-06-30" Output: 1 Example 2: Input: date1 = "2020-01-15", date2 = "2019-12-31" Output: 15 Constraints: The given dates are valid dates between the years 1971 and 2100. Solution import datetime ..
Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. Example 1: Input: date = "2019-01-09" Output: 9 Explanation: Given date is the 9th day of the year in 2019. Example 2: Input: date = "2019-02-10" Output: 41 Example 3: Input: date = "2003-03-01" Output: 60 Example 4: Input: date = "2004-03-01" Output: 61 Constraints: date.length..
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Input: 16 Output: true Example 2: Input: 5 Output: false Follow up: Could you solve it without loops/recursion? Accepted Solution class Solution: def isPowerOfFour(self, num: int) -> bool: if num
Mac에서 Selenium을 활용하여 열심히 크롤링 코드를 작성하여 제대로 동작하는지 확인한 후 호기롭게 Ubuntu 서버에 그대로 파일을 옮긴 뒤 selenium 라이브러리를 설치하고 Linux용 chromedriver를 다운받아 넣은 뒤! 실행을 해보니! 제대로 작동하지 않고 오류가 발생하였습니다. 해결하기 위해 다양한 방법을 찾아보았고 여러 페이지에서 참조한 결과 해결할 수 있었습니다. 그 설치 방법은 다음과 같습니다. 1. Chrome 설치 $ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - $ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.c..
Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with the lower alphabetical order comes first. Example 1: Input: ["i", "love", "leetcode", "i", "love", "coding"], k = 2 Output: ["i", "love"] Explanation: "i" and "love" are the two most frequent words. Note t..
Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9]. Please optimize your algorithm to use less time and space. The input size may be as large as 5,000,000. Solution class Solution: def lexicalOrder(self, n: int) -> List[int]: my_nums = [str(i) for i in range(1, n+1)] my_nums = list(sorted(my_nums)) return my_nums SOMJANG/CODI..
[Python] Python3에서 venv로 가상환경 만들고 사용하기! 예전 Ubuntu에서 Python 가상환경을 만들때에는 virtualenv를 활용하여 가상환경을 만들고 사용했었습니다. Windows에서도 virtualenv를 설치하고자 검색 중 venv라는 더 편하고 쉽게 사용할 수 있는 방법을 somjang.tistory.com 위와 같은 방법으로 Python에서 만든 가상환경을 Jupyter Notebook에 추가하는 방법은 다음과 같습니다. 먼저 만든 가상환경을 활성화 시킵니다. 만들어둔 가상환경의 이름이 myvenv라고 가정하면 $ source myvenv/bin/activate 위와 같은 방법으로 활성화시켜줍니다. 윈도우의 경우 $ myvenv\Scripts\activate 그 다음 pi..
Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explanation: 3! = 6, no trailing zero. Example 2: Input: 5 Output: 1 Explanation: 5! = 120, one trailing zero. Note: Your solution should be in logarithmic time complexity. Solution class Solution: def trailingZeroes(self, n: int) -> int: answer = 0 while n: n //= 5 answer += n return answer SOMJANG/COD..
Ai Hub에서 서버를 지원받아 이전에 멀티캠퍼스에서 진행해보았던 음성합성 프로젝트를 계속 진행해보기로 하였습니다. 음성합성 프로젝트는 carpedm20(김태훈님)님의 multi-speaker-tacotron-tensorflow 오픈소스를 활용하였습니다. carpedm20/multi-speaker-tacotron-tensorflow Multi-speaker Tacotron in TensorFlow. Contribute to carpedm20/multi-speaker-tacotron-tensorflow development by creating an account on GitHub. github.com 이 글에서는 해당 오픈소스를 실행 하면서 마주치는 다양한 이슈들과 그 해결 방법에 대해서 정리해보고자 합..
Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Example 1: Input: [2,2,3,2] Output: 3 Example 2: Input: [0,1,0,1,0,1,99] Output: 99 Solution from collections import Counter class Solution: def sin..
Ai Hub에서 GPU 서버를 지원받아 이전에 멀티캠퍼스에서 Tacotron을 활용한 음성합성을 다시 도전해보기위해서 데이터를 생성하고 학습을 시작하려고하니 ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory 위와 같은 오류가 발생하면서 제대로 실행이 되지 않는 문제가 있었습니다. 원인 Tacotron에서 사용하는 TensorFlow의 버전이 1.3이고 이 TensorFlow 1.3에서 필요로하는 CUDA 버전이 8.0인데 현재 환경은 10.0을 사용하여 요구하는 CUDA 버전과 현재 사용중인 CUDA 버전이 맞지 않기 때문입니다. 해결방법 Ai Hub에서 제공해주는 서버에는 CUDA가 8.0 ..
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will return false. Each letter in the magazine string can only be used once in your ransom note. Example 1: Input: ransomNote = "a", magazine = "b" Output: false Example 2: Input: ransom..
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example 3: Input: 10 Output: false Explanation: Reads 01 from right to left. Therefore it ..
Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Example 1: Given nums = [1,1,2], Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn't..
Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn't banned, and that the answer is unique. Words in the list of banned words are given in lowercase, and free of punctuation. Words in the paragraph are not case sensitive. The answer is in lowercase. Example: Input: paragraph = "..
평소와 같이 아나콘다로 만든 가상환경을 활성화하기 위하여 $ conda activate tensorflow_1_11_p36 위처럼 가상환경 활성화 명령어를 입력하였으나 CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. If your shell is Bash or a Bourne variant, enable conda for the current user with $ echo ". /home/ubuntu/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc or, for all users, enable conda with $ sudo ln -s /home/ubunt..
MAC OS가 업데이트 됨에 따라 기본 쉘도 bash에서 zsh로 변경 되었습니다. 이에 따라 저를 포함한 아직 bash를 사용하는 분들은 터미널을 실행하게되면 Last login: Thu Jul 16 10:55:40 on ttys000 위의 메세지가 나온 다음에 잠시 딜레이 되었다가 The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. 위의 메시지가 로딩된 후에야 정상적으로 사용할 수 있게됩니다. 딜레이 되는 시간이 뭔가 아깝고 신경쓰일때! ..
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 컴퓨팅 수시 사용자 신청이 있다는 것을 알게되었고! 신청을 해보았습니다. 수시 사용자가 신청하여 사용가능한 자원의 스펙 생각보다 신청하는데 큰 어려움이 없이 정말 간단하게..