노트(211)
-
[파이썬 알고리즘 인터뷰] 가장 긴 팰린드롬 부분 문자열
# 6. 가장 긴 팰린드롬 부분 문자열 가장 긴 팰린드롬 부분 문자열을 출력하라. 예제1 * 입력 "babad" * 출력 "bab" 예제2 * 입력 "cbbd" * 출력 "bb" # 슬라이딩 윈도우 # 팰린드롬 판별 및 투 포인터 확장 def expand(s,left:int, right: int) ->str: while left >=0 and right >> "bb"
2020.12.28 -
[파이썬알고리즘 인터뷰] 그룹 애너그램
문자열 배열을 받아 애너그램 단위로 그룹핑하라. * 입력: ["eat", "tea", "tan", "ate", "nat" , "bat"] * 출력" [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] input_ = ["eat", "tea", "tan", "ate", "nat" , "bat"] import collections def anagram(strs): anagrams = collections.defaultdict(list) for word in strs: # 정렬하여 딕셔너리에 추가 anagrams["".join(sorted(word))].append(word) return anagrams.values() anagram(input_) >>> dict_values..
2020.12.25 -
[파이썬 알고리즘 인터뷰] 가장 흔한 단어
# 4. 가장 흔한 단어 금지된 단어를 제외한 가장 흔하게 등장하는 단어를 출력하라. 대소문자 구분을 하지 않으며, 구두점(마침표, 수미표 등) 또한 무시한다 * 입력: paragraph = "Bob hit a ball, the hit BALL flew far after it was hit." banned = ["hit"] * 출력 "ball" paragraph = "Bob hit a ball, the hit BALL flew far after it was hit." banned = ["hit"] import re import collections def common_word(paragraph): words=[word for word in re.sub(r'[^\w]'," ",paragraph).lower..
2020.12.24 -
[시계열] 케라스에서 Luong 어텐션을 활용한 seq2seq2 LSTM 모델 만들기 (번역)
원문 Building Seq2Seq LSTM with Luong Attention in Keras for Time Series Forecasting | by Huangwei Wieniawska | Level Up Coding (gitconnected.com) Building Seq2Seq LSTM with Luong Attention in Keras for Time Series Forecasting Do you want to try some other methods to solve your forecasting problem rather than traditional regression? There are many neural network… levelup.gitconnected.com 시계열 예측을 위..
2020.12.16 -
[시계열] Time Series에 대한 머신러닝(ML) 접근
원문 towardsdatascience.com/ml-approaches-for-time-series-4d44722e48fe ML Approaches for Time Series In this post I play around with some Machine Learning techniques to analyze time series data and explore their potential use in this case… towardsdatascience.com ML Approaches for Time Series 비-전통적인 모델로 타임시리즈를 모델링 해봅시다. 이번 포스팅에서는 타임시리즈 데이터를 분석하기위해 머신러닝 기법을 사용하고, 이 시나리오 하에서 잠재적인 사용을 분석할 것입니다. 첫번째 포스..
2020.12.12 -
[파이썬 알고리즘 인터뷰] 로그파일 재정렬
출처 : 파이썬 알고리즘 인터뷰 6장 로그파일 재정렬 로그를 재정렬하라. 기준은 다음과 같다. 로그의 가장 앞 부분은 식별자다. 문자로 구성된 로그가 숫자 로그보다 앞에 온다. 식별자는 순서에 영향을 끼치지 않지만, 문자가 동일할 경우 식별자 순으로 한다. 숫자 로그는 입력 순서대로 한다. 입력 logs = ["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit dig","let3 art zero"] 출력 ["let1 art can", "let3 art zoo", "let2 own kit dig", "dog1 8 1 5 1","dig2 3 6"] logs = ["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit d..
2020.12.11