[Python] 819. Most Common Word
·
study/LeetCode
leetcode.com/problems/most-common-word/ Most Common Word - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 풀이 class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: words = [word for word in re.sub(r'[^\w]', ' ', paragraph).lower().split() if word not i..
[Python] 937. Reorder Log Files
·
study/LeetCode
leetcode.com/problems/reorder-data-in-log-files/ Reorder Data in Log Files - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 풀이 class Solution: def reorderLogFiles(self, logs: List[str]) -> List[str]: digits, letters = [], [] # 구분해서 리스트 넣기 for i in logs: if i.split()[1].isdigit(): ..
[Python] 344. Reverse String
·
study/LeetCode
leetcode.com/problems/reverse-string/ Reverse String - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 풀이 class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ time = len(s)/2 count = 0 while time >= 1 : time -= 1 ..
[Python] 125. Valid Palindrome
·
study/LeetCode
https://leetcode.com/problems/valid-palindrome/ Valid Palindrome - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 풀이 from collections import deque class Solution: def isPalindrome(self, s: str) -> bool: # 소문자로 만들기 s = s.lower() # 문자를 넣을 deque strings = deque() # 소문자로 통일한 문장에서 영어, ..