Python20 [ Python ] 파이썬 자리수마다 더하기 while x>0: sum += x % 10 x = x//10 print(sum) for i in str(x): sum+= int(i) print(sum) 두번째 방법은 파이썬이라서 가능한 것 같다. 직관적이라서 좋다! 2021. 6. 22. [ LeetCode ] 819번 Most Common Word 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: #data cleansing words = [word for word in re.sub('[^\w]',' ',paragraph).lower().split() if .. 2021. 4. 18. [ LeetCode ] 937번 Reorder Data in Log Files 풀이 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]: letters, digits = [],[] for log in logs: if log.split()[1].isdigit(): digits.append(.. 2021. 4. 16. [ LeetCode ] 344번 Reverse String 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: s.reverse() 2021. 4. 15. 이전 1 2 3 4 5 다음