[leetcode-43] Multiply Strings
ยท
๐Ÿข One step
LeetCode-43 Multiply Strings : Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. note : Note: You must not use any built-in BigInteger library or convert the inputs to integer directly. :::python class Solution: def multiply(self, num1: str, num2: str) -> str: if (num1=='0') or (num2=='0'): ret..
[CV] Online CV template
ยท
๐Ÿƒ Routine
https://github.com/sharu725/online-cv GitHub - sharu725/online-cv: A minimal Jekyll Theme to host your resume (CV) A minimal Jekyll Theme to host your resume (CV). Contribute to sharu725/online-cv development by creating an account on GitHub. github.com https://github.com/sneas/cv-template GitHub - sneas/cv-template: An easy way to create HTML and PDF versions of your resume, and automatically h..
[leetcode-14] Longest Common Prefix
ยท
๐Ÿข One step
LeetCode-14 Longest Common Prefix : Write a function to find the longest common prefix string amongst an array of strings. note : If there is no common prefix, return an empty string "".Answer :::python class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if len(strs)==1: return strs[0] answer = '' i = 0 min_p = min([len(s) for s in strs]) if min_p==0: return "" while i
Lambda ํ•จ์ˆ˜๋ž€?
ยท
๐Ÿ Python
Lambda ํ•จ์ˆ˜๋ž€ ๋ฌด์—‡์ธ๊ฐ€? Lambda ํ•จ์ˆ˜๋Š” ์ต๋ช… ํ•จ์ˆ˜(anonymous function)๋ฅผ ์ƒ์„ฑํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํ•จ์ˆ˜๋Š” ๋ณ€์ˆ˜์— ๋Œ€์ž…ํ•˜์—ฌ ํ•จ์ˆ˜๋ฅผ ์ €์žฅํ•˜๊ฑฐ๋‚˜, ์ธ์ž(argument)๋กœ ๋‹ค๋ฅธ ํ•จ์ˆ˜์— ์ „๋‹ฌํ•˜๊ฑฐ๋‚˜, ๋ฐ˜ํ™˜๊ฐ’์œผ๋กœ ๋‹ค๋ฅธ ํ•จ์ˆ˜์—์„œ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Lambda ํ•จ์ˆ˜๋Š” ๊ฐ„๋‹จํ•œ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉฐ, ์ผ๋ฐ˜์ ์œผ๋กœ ํ•œ ์ค„ ์•ˆ์— ์ •์˜๋ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํŠน์ง• ๋•Œ๋ฌธ์—, Lambda ํ•จ์ˆ˜๋Š” ํŠน๋ณ„ํ•œ ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. Lambda ํ•จ์ˆ˜์˜ ๊ตฌ๋ฌธ Lambda ํ•จ์ˆ˜์˜ ๊ตฌ๋ฌธ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. lambda arguments: expression ์—ฌ๊ธฐ์„œ arguments๋Š” ํ•จ์ˆ˜์— ์ „๋‹ฌ๋  ์ธ์ž(argument)๋“ค์˜ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค. expression์€ ์ธ์ž๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ณ„์‚ฐํ•  ํ‘œํ˜„์‹์ž…๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ๊ฐ„๋‹จ..
[leetcode-12] Integer to Roman
ยท
๐Ÿข One step
LeetCode-12 Integer to Roman : Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. note : Given an integer, convert it to a roman numeral.Answer :::python class Solution: def intToRoman(self, num: int) -> str: roman_dict = { 0 : "V" ,1 : "L" ,2 : "D" } d_dict= { 0 : "I" ,1 : "X" ,2 : "C" ,3 : "M" } answer = '' set_num = 3 while set_num >= 0: remain = num //..
[RL] Stable-baselines3 gym -> gymnasium
ยท
๐Ÿ‘พ Deep Learning
RL ๊ณ„๋ณด๋กœ ๋ณด๋ฉด OpenAI์™€ Deepmind์ด ๋‘˜์ด ๊ฑฐ์˜ ๋‹คํ–ˆ๋‹ค๊ณ  ๋ณด๋ฉด ๋œ๋‹ค.. ์ฝ”๋“œ๋ฉฐ paper๋ฉฐ ํ•˜์ง€๋งŒ ์š”์ฆ˜ RL ๋ณด๋‹ค NLP LLM ๋ชจ๋ธ์— ๊ด€์‹ฌ์ด ์ ๋ฆฌ๋ฉด์„œ ๊ณผ๊ฑฐ OpenAI baseline git ์ด๋‚˜ Deepmind rl acme git์ด ์—…๋ฐ์ดํŠธ ๋˜์ง€ ์•Š๊ณ  ์žˆ๋‹ค. ๊ทธ ์‚ฌ์ด gym์˜ ํ›„์› ์žฌ๋‹จ์ด ๋ฐ”๋€Œ๋ฉด์„œ gymnasium์œผ๋กœ ๋ณ€ํ˜•๋˜๊ณ  ์ผ๋ถ€ return ๋ฐฉ์‹์ด ๋ฐ”๋€Œ์—ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋Œ€๋ถ€๋ถ„์˜ 2~3๋…„์ด ์ง€๋‚œ ์ฝ”๋“œ๋“ค์€ ๊ณผ๊ฑฐ gym๋ฒ„์ „์˜ ํŒจํ‚ค์ง€๊ฐ€ ์•„๋‹ˆ๋ฉด ํ˜ธํ™˜์ด ๋˜์ง€ ์•Š๊ณ ์žˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‹คํ–‰ํžˆ stable-baselines์—์„œ ์ตœ๊ทผ gymnasium์œผ๋กœ ์ฝ”๋“œ๋ฅผ ๋ณ€๊ฒฝํ•ด ์ฃผ์—ˆ๋‹ค. ์ด ํŒจํ‚ค์ง€๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๊ธฐ์กด ๋Œ€๋ถ€๋ถ„์˜ PPO, HER, DDPG ๋“ฑ RL model์„ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๊ณ  custom ํ™˜๊ฒฝ๋„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ฒŒ..
๋‹คํ–ˆ๋‹ค
B's