LeetCode - Time complexity ์‹œ๊ฐ„ ๋ณต์žก๋„
ยท
๐Ÿข One step
https://www.reddit.com/r/leetcode/comments/w26u7o/could_someone_please_explain_the_difference_in/ https://www.reddit.com/r/MLQuestions/comments/wz7s5h/can_someone_explain_time_complexity_and_what_doe/ r/MLQuestions on Reddit: Can someone explain time complexity and what doe sit has to do with data structures like LinkedList and Posted by u/Important-Asparagus9 - 1 vote and 4 comments www.reddit...
[leetcode-819] Most Common Word
ยท
๐Ÿข One step
LeetCode-819 Most Common Word : ๊ธˆ์ง€๋œ ๋‹จ์–ด๋ฅผ ์ œ์™ธํ•œ ๊ฐ€์žฅ ๋งŽ์€ ๋นˆ๋„์˜ ๋‹จ์–ด ์ถ”์ถœ Info : ๋Œ€์†Œ ๋ฌธ์ž, ๊ตฌ๋‘์  ๋ฌด์‹œclass Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: return Counter([word for word in re.sub("[^a-z]", ' ',paragraph.lower()).split() if word not in banned]).most_common(1)[0][0] Result : 28 Memory: 13.9mb
[leetcode-937] Reorder_Data_in_LogFile
ยท
๐Ÿข One step
LeetCode-937 Reorder_Data_in_LogFile : reorder log files ์ฒซ๋ฒˆ์งธ ๋ฌธ์ž ์‹๋ณ„์ž ex) "dig2 a","dig1 b"-> "a","b"Myanswerclass Solution: def reorderLogFiles(self, logs: List[str]) -> List[str]: let = [] digit = [] for i in logs: if i.split()[1].isdigit()==False: let.append(i) else: digit.append(i) let.sort(key = lambda x: (x.split()[1:], x.split()[0])) #digit.sort(key = lambda x: x.split()[1:],reverse=True) r..
leetCode python code markdown ๋ณ€ํ™˜๊ธฐ
ยท
๐Ÿ Python
vscode editor๋กœ ์ฝ”๋”ฉ์„ ๋งŽ์ด ํ•˜๋‹ค๋ณด๋‹ˆ ํฌ์ŠคํŒ…ํ•  ๋•Œ ์ฝ”๋“œ ๋ธ”๋Ÿญ์„ ๋งŒ๋“ค์–ด์ฃผ๋Š” ์ผ์ด ๋„ˆ๋ฌด ๊ท€์ฐฎ์•„์„œ ๋งˆํฌ๋‹ค์šด ์ž๋™๋ณ€ํ™˜๊ณผ Tstory์— ๋ฐ”๋กœ ํฌ์ŠคํŒ…์ด ๋˜๋„๋ก ๊ฐœ๋ฐœํ•˜๊ณ  ์žˆ๋‹ค. using python-markdown for posting Tstory python2Markdown.py [span code block & markdown] LeetCode-0 subject : info sub {code} Result : 0 Memory: 0mb
[leetcode-344] ReverseString
ยท
๐Ÿข One step
LeetCode-344 ReverseString : ๋ฌธ์ž์—ด ๋ฆฌ์ŠคํŠธ ๋’ค์ง‘๊ธฐ ๋ฆฌํ„ด ์—†์ด ๋ฆฌ์ŠคํŠธ ๋‚ด๋ถ€์˜ ์ฃผ์†Œ ๊ฐ’์ด ๋ณ€ํ•˜๋„๋ก my answer class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ for i in range(len(s)): s.append(s.pop(-i-1)) Result : 394 Memory: 18.4mb 1. ํˆฌ ํฌ์ธํŠธ ์Šค์™‘ {code} Result : 205 Memory: 18.5mb
[leetcode-125] Palindrome + Slicing
ยท
๐Ÿข One step
using Slicing leetcode-125 + ์ •๊ทœ์‹ ์‚ฌ์šฉimport re import collections class Solution: def isPalindrome(self, s: str) -> bool: s = s.lower() s = re.sub('[^a-z0-9]','',s) return s == s[::-1] # reverse Result : 46ms Memory: 15.7mb
๋‹คํ–ˆ๋‹ค
B's