[Python/LeetCode]코딩테스트 준비를 위한 파이썬 알고리즘 문제 5.Longest Palindromic Substring 참조해설(Medium level)
2020. 1. 19. 01:39
알고리즘 문제
문제 5. Longest palindromic substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd" Output: "bb" 오늘 해설의 idea는 "Chomolungma" 라는 유저의 글을 참고하였습니다. def longestPalindrome(s): #문자열이 공백인 경우 그대로 출력 if len(s)==0: return s flag=1 start=0 #문..
[Python/LeetCode]코딩테스트 준비를 위한 파이썬 알고리즘 문제 4.Median of Two Sorted Arrays 해설(High level)
2020. 1. 18. 21:02
알고리즘 문제
문제 4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5 두 개의 sorted ..
[Python/LeetCode]코딩테스트 준비를 위한 파이썬 알고리즘 문제 3.longest substring without repeating characters 해설(medium level)
2020. 1. 18. 18:10
알고리즘 문제
문제 3. longest substring without repeating characters Given a string, find the length of the longest substring without repeating characters. Example 1:Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:Input: "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3:Input: "pwwkew" Output: 3 Explanation: The answer is "wke", with ..
[Python/LeetCode]코딩테스트 준비를 위한 파이썬 알고리즘 문제 1.twoSum 해설(easy level)
2020. 1. 15. 00:06
알고리즘 문제
문제 1. twoSum 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]. int 자료형으로 구성된 list의 요소끼리 서로 더했을 때 target이 되는 경우를 찾고, 해당하는 값의 index를..
[Python/NLP]파이썬을 이용해 웹문서(HTML)를 PDF로 변환하기
2020. 1. 14. 22:43
Data/Data Engineering
웹문서를 PDF로 변환해 저장해야할 때가 있습니다. 이럴때를 위해 준비된 Python 라이브러리를 소개합니다. import pdfcrowd import sys 오늘 사용될 라이브러리는 pdfcorwd 로 https://pdfcrowd.com/doc/api/html-to-pdf/python/자세한 사용법은 하단 링크를 확인하시면 됩니다. HTML to PDF API for Python | Pdfcrowd top Set the output page top margin. Can be specified in inches (in), millimeters (mm), centimeters (cm), or points (pt). Default: 0.4in right Set the output page right mar..
[python]웹 크롤링(crawling) - Riss 논문 검색 데이터를 csv파일로 저장하기
2020. 1. 11. 14:35
Data/Data Engineering
다중 스레드를 활용한 Riss 논문 데이터 크롤러에 관한 링크입니다. [python]파이썬 동시성/비동기 프로그래밍 5. 활용 예시 Riss Crawler 만들어서 Riss 논문 데이터 다운로 파이썬 동시성/비동기 프로그래밍 4. concurrent.futures [Python]파이썬 동시성/비동기 프로그래밍 4. concurrent.futures 파이썬 동시성/비동기 프로그래밍 3. GIL(Global interpreter Lock) [Python]파이썬 동.. leo-bb.tistory.com 현 문서와의 차이점 1. 동시성을 이용해 속도 증가 2. 쉬운 사용법과 간결함 3. 비제한적 크롤링에 관한 전반적인 방법은 이전 글을 참고해주시기 바랍니다. Basic Riss crawl 어떤 목적을 가지고 연..
[Python]자연어 처리를 위한 데이터 수집 웹 크롤링-2(crawling-2) list/str 자료형의 특징 및 re(정규화)
2020. 1. 6. 22:19
Data/Data Engineering
2020/01/05 - [Python 3/Natural Language Processing] - 크롤링(crawling) 크롤링(crawling) NLP를 위해 데이터를 수집하는데 있어 우리는 많은 데이터를 인터넷을 통해 구하게 됩니다. 그러한 데이터의 양이 적당히 적은 수준이라면 충분히 반복작업을 통해 사용자가 직접 데이터를 수집할 수 있습니다. 그.. leo-bb.tistory.com 읽으시기 전에 이전 글을 참고하시기 바랍니다. 이전에 추출된 데이터를 살펴보면 두가지 문제를 확인할 수 있습니다. 1. 기사 초두 및 마지막 부분에 광고 삽입. 2. 특수문자 등 불필요한 내용이 본문에 섞여있음. 기사의 html을 다시 확인해보면 본문이 나오기 전에 각종 광고 배너에 대한 class 및 태그가 먼저 등장..