[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
[2023-2] ATOMIC HABITS
ยท
๐Ÿ“š Book
James Scholz study with me send me mail! James Scholz P.O. BOX 9373 Salt Lake City, UT 84109 If you have an offer, opportunity, or introduction that makes my life more interesting, e-mail me at the provided e-mail address below. For the reasons stated above, I'll only www.youtube.com 1๋…„๋™์•ˆ ๋งค์ผ 12์‹œ๊ฐ„ ๊ณต๋ถ€๋กœ ์œ ๋ช…ํ•œ ์œ ํŠœ๋ฒ„ James Scholz ์ถ”์ฒœ ๋„์„œ ์ด๋‹ค. ์•„ํ† ๋ฏน ์ž‘์€ ์Šต๊ด€์€ ์ €์ž์˜ ๊ฒฝํ—˜๋‹ด์„ ๋ฐ”ํƒ•์œผ๋กœ ์Šต๊ด€์ด ๊ฐ€์ ธ์˜จ ๊ฒฐ๊ณผ์™€ ์Šต๊ด€์„ ๋“ค์ด๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์„ค๋ช…ํ•ด ์ฃผ์—ˆ๋‹ค. ์šฐ๋ฆฌ๊ฐ€ ..
[2023-1] DEEP WORK
ยท
๐Ÿ“š Book
https://www.youtube.com/@JamesScholz James Scholz study with me send me mail! James Scholz P.O. BOX 9373 Salt Lake City, UT 84109 If you have an offer, opportunity, or introduction that makes my life more interesting, e-mail me at the provided e-mail address below. For the reasons stated above, I'll only www.youtube.com 1๋…„ ๋™์•ˆ ๋งค์ผ 12์‹œ๊ฐ„ ๊ณต๋ถ€๋กœ ์œ ๋ช…ํ•œ ์œ ํŠœ๋ฒ„ James Scholz ์ถ”์ฒœ ๋„์„œ ์ด๋‹ค. ์ž๊ธฐ ๊ฐœ๋ฐœ์„œ๋Š” ๋งˆ์Œ๋จน๊ธฐ ๋‹ฌ๋ ธ๋‹ค๋Š” ์ฃผ์˜์— ๋ˆ์„ ๋“ค์—ฌ..
[leetcode-125] Palindrome
ยท
๐Ÿข One step
LeetCode 125 Valid Palindrome Palindrome : ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ ์—†์ด ์ขŒ์šฐ๊ฐ€ ๋Œ€์นญ์ธ ๋ฌธ์ž์—ด 1. isalnum : ๋ฌธ์ž ํŒ๋ณ„ ํ›„ ์†Œ๋ฌธ์ž ๋ณ€ํ™˜ test = 'is a car ; rac a si' c_string = [] for s in test: if s.isalnum(): # ๋ฌธ์ž์ธ์ง€ ํŒ๋ณ„ c_string.append(s.lower()) # ์†Œ๋ฌธ์ž๋กœ ๋ณ€ํ™˜ # c_string # ['i', 's', 'a', 'c', 'a', 'r', 'r', 'a', 'c', 'a', 's', 'i'] 2. loop๋กœ ์ฒซ๋ฒˆ์งธ ๋งˆ์ง€๋ง‰ ๋ฌธ์ž์—ด ๋น„๊ต ํ›„ pop while len(c_string) > 1: if c_string.pop(0) != c_string.pop(): break #c_string ..
[2023-7] ํ˜„๋ช…ํ•œ ํˆฌ์ž์ž(์„ฑ์žฅ์ฃผ์— ์ ์šฉํ•˜๋Š” ์ž๋ณธํ™”๊ณ„์ˆ˜)
ยท
๐Ÿ“š Book
์ž๋ณธํ™”๊ณ„์ˆ˜ ์œ ๋ช…ํ•œ ๋ฏธ๊ตญ ๊ฒฝ์ œ ํ•™์ž ๋ฒค์ €๋ฏผ ๊ทธ๋ ˆ์ด์—„์˜ "ํ˜„๋ช…ํ•œ ํˆฌ์ž์ž"์—์„œ๋Š” ์„ฑ์žฅ์ฃผ์— ๋Œ€ํ•œ ์ž๋ณธํ™” ๊ณ„์ˆ˜ ์ ์ • ์ฃผ๊ฐ€๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ˆ˜์‹์œผ๋กœ ์ •์˜ํ–ˆ๋‹ค. ์„ฑ์žฅ์ฃผ์˜ ์ ์ • ์ฃผ๊ฐ€ = EPS X (8.5 + 2 X ๊ธฐ๋Œ€ ์„ฑ์žฅ๋ฅ ) (2023.2.26) ํ…Œ์Šฌ๋ผ ์ฃผ๊ฐ€๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๊ณ„์‚ฐํ•ด ๋ณด์•˜๋‹ค. ํ…Œ์Šฌ๋ผ ํ˜„์žฌ๊ฐ€ : $196.48 EPS : $3.62 ๊ธฐ๋Œ€ ์„ฑ์žฅ๋ฅ  : 31% (์ถœ์ฒ˜) ์ ์ • ์ฃผ๊ฐ€ : 255.21 = 3.62 X (8.5 + 2 X 31) ํ˜„์žฌ ์ €ํ‰๊ฐ€๋˜๋Š” ์ฃผ์‹์ด๋ผ๊ณ  ํ•  ์ˆ˜ ์žˆ๋‹ค?! ํ…Œ์Šฌ๋ผ๋Š” ๋ฐฐ๋‹น์„ ์ง€๊ธ‰ํ•˜์ง€ ์•Š๋Š” ์ฃผ์‹์œผ๋กœ ๋ฒค์ €๋ฏผ ๊ทธ๋ ˆ์ด์—„์˜ ์ˆ˜์‹์— ๋„ฃ์œผ๋ฉด ์•ˆ ๋œ๋‹ค. ๋˜ํ•œ ๊ธฐ๋Œ€์„ฑ์žฅ๋ฅ ์€ 7~10๋…„ ํ›„์˜ ๊ธฐ๋Œ€ ์„ฑ์žฅ๋ฅ ์ž„์— ์ •ํ™•๋„๊ฐ€ ๋–จ์–ด์งˆ ์ˆ˜ ์žˆ๋‹ค. ํ˜„์žฌ ํ‰๊ฐ€๋˜๋Š” ์ˆ˜์‹์€ ๋” ๋งŽ์€ ์ง€ํ‘œ๋ฅผ ํ‰๊ฐ€์ง€ํ‘œ๋กœ ์‚ถ๋Š”๋‹ค. ์ด ์‹์˜ ์ตœ๋Œ€ ์˜ค๋ฅ˜๋Š” ..
๋‹คํ–ˆ๋‹ค
B's