๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

IN DEPTH CAKE

(40)
Inductive Bias, ๊ทธ๋ฆฌ๊ณ  Vision Transformer (ViT) ๋“ค์–ด๊ฐ€๋Š” ๋ง Transformer๋Š” (CNN๋ณด๋‹ค) Inductive Bias๊ฐ€ ์•ฝํ•œ ๋„คํŠธ์›Œํฌ๋กœ, general-purpose ๋„คํŠธ์›Œํฌ์˜ ์ƒˆ๋กœ์šด ์ง€ํ‰์„ ์—ฐ ๊ตฌ์กฐ๋กœ ํ‰๊ฐ€๋ฐ›์Šต๋‹ˆ๋‹ค. Inductive Bias๊ฐ€ ์ ๋‹ค๋Š” ๊ฒƒ์€ ์–‘๋‚ ์˜ ๊ฒ€์ธ๋ฐ, ์ด๋ฅผ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Inductive Bias๊ฐ€ ๋ฌด์—‡์ธ์ง€ ๊ทธ๋ฆฌ๊ณ  Inductive Bias๊ฐ€ ํ•™์Šต์— ๋ผ์น˜๋Š” ์˜ํ–ฅ์„ ์ดํ•ดํ•  ํ•„์š”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ๊ธ€์—์„œ๋Š” ์ถ”์ƒํ™”๋œ ํ˜•ํƒœ๋กœ Inductive Bias๋ฅผ ์„ค๋ช…ํ•ด๋ณด๋ ค ํ•ฉ๋‹ˆ๋‹ค. In computer vision, there has recently been a surge of interest in end-to-end Transformers, prompting efforts to replace hand-wired features or i..
[์ฝ”๋”ฉ/LeetCode150-(10)] 45. Jump Game II ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python3์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: Medium ํ‚ค์›Œ๋“œ: Array, DP ๋ฌธ์ œ ๋ฌธ์ œ ์›๋ฌธ: https://leetcode.com/problems/jump-game-ii/?envType=study-plan-v2&envId=top-interview-150 ์ •์ˆ˜ํ˜• ๋ฐฐ์—ด nums๊ฐ€ ์ฃผ์–ด์กŒ๋‹ค๊ณ  ํ•˜์ž. ๋‹น์‹ ์€ ์ฒ˜์Œ์— ๋ฐฐ์—ด์˜ ์ฒซ๋ฒˆ์งธ index์— ์œ„์น˜ํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๋ฐฐ์—ด์˜ ๊ฐ ์›์†Œ๋Š” ํ•ด๋‹น ์œ„์น˜์—์„œ๋ถ€ํ„ฐ ๋‹น์‹ ์ด ์ตœ๋Œ€๋กœ ์ ํ”„ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธธ์ด๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. ์ด ๋•Œ, ๋งˆ์ง€๋ง‰ index ์— ๋„๋‹ฌํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ jump ์ˆ˜์˜ ์ตœ์†Ÿ๊ฐ’..
[์ฝ”๋”ฉ/LeetCode150-(9)] 55. Jump Game ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: Medium ํ‚ค์›Œ๋“œ: Array, DP ๋ฌธ์ œ ๋ฌธ์ œ ์›๋ฌธ: https://leetcode.com/problems/jump-game/description/?envType=study-plan-v2&envId=top-interview-150 ์ •์ˆ˜ํ˜• ๋ฐฐ์—ด nums๊ฐ€ ์ฃผ์–ด์กŒ๋‹ค๊ณ  ํ•˜์ž. ๋‹น์‹ ์€ ์ฒ˜์Œ์— ๋ฐฐ์—ด์˜ ์ฒซ๋ฒˆ์งธ index์— ์œ„์น˜ํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๋ฐฐ์—ด์˜ ๊ฐ ์›์†Œ๋Š” ํ•ด๋‹น ์œ„์น˜์—์„œ๋ถ€ํ„ฐ ๋‹น์‹ ์ด ์ตœ๋Œ€๋กœ ์ ํ”„ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธธ์ด๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. ์ด ๋•Œ, ๋งˆ์ง€๋ง‰ index ์— ๋„๋‹ฌํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ t..
[์ฝ”๋”ฉ/LeetCode150-(8)] Best Time to Buy and Sell Stock II (122) ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: Medium ํ‚ค์›Œ๋“œ: Array, Greedy ๋ฌธ์ œ ๋ฌธ์ œ ์›๋ฌธ: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/?envType=study-plan-v2&envId=top-interview-150 prices๋ผ๋Š” ๋ฐฐ์—ด์ด ์ฃผ์–ด์ง„๋‹ค๊ณ ํ•˜์ž. ์ด ๋ฐฐ์—ด์˜ i๋ฒˆ์งธ ์›์†Œ๋“ค์€ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ์„ ์˜๋ฏธํ•œ๋‹ค. ํ•œ ๋ฒˆ์— ํ•˜๋‚˜์˜ ์ฃผ์‹๋งŒ ๊ฐ€์ง€๊ณ  ์žˆ์„ ์ˆ˜ ์žˆ๋‹ค. ๋‹จ, ์ฃผ์‹์„ ํŒ”์ž๋งˆ์ž ๋‹น์ผ์— ๋ฐ”๋กœ ์‚ด ์ˆ˜ ์žˆ๋‹ค. ..
[์ฝ”๋”ฉ/LeetCode150-(7)] Best Time to Buy and Sell Stock (121) ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: EASY ํ‚ค์›Œ๋“œ: Array ๋ฌธ์ œ ๋ฌธ์ œ ์›๋ฌธ: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/?envType=study-plan-v2&envId=top-interview-150 prices๋ผ๋Š” ๋ฐฐ์—ด์ด ์ฃผ์–ด์ง„๋‹ค๊ณ ํ•˜์ž. ์ด ๋ฐฐ์—ด์˜ i๋ฒˆ์งธ ์›์†Œ๋“ค์€ ์ฃผ์‹์˜ ๊ฐ€๊ฒฉ์„ ์˜๋ฏธํ•œ๋‹ค. ์ด ๋•Œ ์—ฌ๋Ÿฌ๋ถ„์€ ์ฃผ์‹์„ ์‚ฌ๋Š” ๋‚ ๊ณผ ํŒŒ๋Š” ๋‚ ์„ ์ •ํ•˜๋ ค๊ณ ํ•œ๋‹ค. ๊ฐ€๋Šฅํ•œ ๊ฑฐ๋ž˜ ๊ฒฝ์šฐ์˜ ์ˆ˜ ์ค‘ ์ตœ๋Œ€ ์ด์œค ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋ผ. (๋„ˆ๋ฌด ๋‹น์—ฐํ•˜๊ฒŒ๋„ ๋งค๋„๋Š” ๋งค..
[์ฝ”๋”ฉ/LeetCode150-(6)] Rotate Array (189) ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python3์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: Medium ํ‚ค์›Œ๋“œ: Array ๐Ÿ”’ ๋ฌธ์ œ ๋ฌธ์ œ ์›๋ฌธ: https://leetcode.com/problems/rotate-array/description/?envType=study-plan-v2&envId=top-interview-150 ์ •์ˆ˜ ๋ฐฐ์—ด nums๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ ์ฃผ์–ด์ง„ ์Œ์ด ์•„๋‹Œ ์ •์ˆ˜ k์— ๋Œ€ํ•ด์„œ k ๋ฒˆ๋งŒํผ ๋ฐฐ์—ด์„ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ํšŒ์ „์‹œ์ผœ๋ผ ๐Ÿงช ์˜ˆ์ œ Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4] Expla..
[์ฝ”๋”ฉ/LeetCode150-(5)] Majority Element (169) ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: EASY ํ‚ค์›Œ๋“œ: Array, Hash Table ๋ฌธ์ œ ๋ฌธ์ œ ์›๋ฌธ: https://leetcode.com/problems/majority-element/description/ ํฌ๊ธฐ๊ฐ€ n์ธ ๋ฐฐ์—ด nums๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ์ตœ๋นˆ๋„ (the majority) ์›์†Œ๋ฅผ ๋ฐ˜ํ™˜ํ•ด๋ผ. ์ตœ๋นˆ (majority) ์›์†Œ๋Š” ํ•ญ์ƒ ์กด์žฌํ•˜๋ฉฐ, ์ด ์›์†Œ์˜ ์ˆ˜๋Š” ๋ฐฐ์—ด ๊ธธ์ด์˜ ์ ˆ๋ฐ˜์„ ๋„˜๋Š”๋‹ค. ์˜ˆ์ œ Input: nums = [3,2,3] Output: 3 Input: nums = [2,2,1,1,1,2..
[์ฝ”๋”ฉ/LeetCode150-(4)] Remove Duplicates from Sorted Array II(80) ๋ณธ ๊ธ€์€ LeetCode Top Interview 150์— ์ •๋ฆฌ๋œ ๋ฌธ์ œ๋ฅผ ์š”์•ฝํ•˜๊ณ  ์ด์— ๋Œ€ํ•œ ๊ฐœ์ธ์ ์ธ ํ’€์ด๋ฅผ ํฌํ•จํ•˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” 150 list์˜ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ผ์„œ ๊ฒŒ์žฌ๋ฉ๋‹ˆ๋‹ค. ํ’€์ด ์–ธ์–ด๋Š” python์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚œ์ด๋„: MEDIUM ํ‚ค์›Œ๋“œ: Array, Two-Pointers ๋ฌธ์ œ ๋ฌธ์ œ์›๋ฌธ: https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/description/?envType=study-plan-v2&envId=top-interview-150 ์ฃผ์–ด์ง„ ๊ฐ์†Œํ•˜์ง€ ์•Š๋Š” ์ˆœ์„œ๋กœ ์ •๋ ฌ๋œ ์ •์ˆ˜ ๋ฐฐ์—ด nums์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ๋™์ผํ•œ ๊ฐ’์ด ์ตœ๋Œ€ ๋‘๋ฒˆ๋งŒ ๋ฐ˜๋ณต๋˜๋„๋ก in-placeํ˜•ํƒœ๋กœ nums๋ฅผ ์—…๋ฐ์ดํŠธํ•ด๋ผ. (๋‹ค์‹œ ๋งํ•ด, 3..