일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- programmers
- 데이콘
- 백준
- PYTHON
- hackerrank
- AI 경진대회
- gs25
- github
- 파이썬
- Git
- 자연어처리
- 맥북
- 우분투
- Real or Not? NLP with Disaster Tweets
- 편스토랑
- leetcode
- 더현대서울 맛집
- Docker
- ubuntu
- 코로나19
- Kaggle
- SW Expert Academy
- 프로그래머스 파이썬
- 편스토랑 우승상품
- 캐치카페
- Baekjoon
- dacon
- ChatGPT
- 금융문자분석경진대회
- 프로그래머스
- Today
- Total
목록
반응형
분류 전체보기 (1651)
솜씨좋은장씨
Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Input: "hello" Output: "holle" Example 2: Input: "leetcode" Output: "leotcede" Note: The vowels does not include the letter "y". Solution class Solution(object): def reverseVowels(self, s): s_list = list(s) vowels = [] for i, val in enumerate(s_list): if val in ['a', 'o', 'e', 'i', 'u', 'A', 'O', 'E..
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Could you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space. Example: Input: [4,3,2,7,8,2,3,1] Output: [5,6] Solution class Solution: def findDi..
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Example 1: Input: [1,3,5,6], 5 Output: 2 Example 2: Input: [1,3,5,6], 2 Output: 1 Example 3: Input: [1,3,5,6], 7 Output: 4 Example 4: Input: [1,3,5,6], 0 Output: 0 Solution class Solution: def searchI..
Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Example 1: Input: pattern = "abba", str = "dog cat cat dog" Output: true Example 2: Input:pattern = "abba", str = "dog cat cat fish" Output: false Example 3: Input: pattern = "aaaa", str = "dog cat cat dog"..
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself. Example 1: Input: s = "egg", t = "add" Output: true Example 2: In..
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the string does not contain any non-printable characters. Example: Input: "Hello, my name is John" Output: 5 Solution class Solution: def countSegments(self, s: str) -> int: answer = len(s.split()) return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.0..
Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. Example 1: Input: s = "codeleet", indices = [4,5,6,7,0,2,1,3] Output: "leetcode" Explanation: As shown, "codeleet" becomes "leetcode" after shuffling. Example 2: Input: s = "abc", indice..
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. 위의 메시지가 로딩된 후에야 정상적으로 사용할 수 있게됩니다. 딜레이 되는 시간이 뭔가 아깝고 신경쓰일때! ..