The journey to becoming a developer

My future is created by what I do today, not tomorrow.

What I learned/CodeSquad Log

CodeSquad Day 8 : LeetCode Algorithms (6)

Millie 2022. 1. 12. 23:49

 

CodeSquad๐Ÿ”นDay 8

10:00~11:00 2022 ๋งˆ์Šคํ„ฐ์ฆˆ ์ปค๋ฎค๋‹ˆํ‹ฐ ์ด๋ฒคํŠธ 

์˜ค๋Š˜์€ ์ฝ”๋“œ์Šค์ฟผ๋“œ์—์„œ ์ฒซ ์ด๋ฒคํŠธ๊ฐ€ ์—ด๋ ธ๋‹ค! ์ฝ”๋“œ์Šค์ฟผ๋“œ์˜ ๋งค๋‹ˆ์ €์ธ ํด๋กœ์ด๊ฐ€ ์ง„ํ–‰ํ•ด์„œ ํ€ด์ฆˆ๋„ ํ’€๊ณ . ๋‚˜๋Š” ๋”ฑ ์ค‘๊ฐ„์„ ํ–ˆ๋‹ค. ๋‹ค๋“ค ์ •๋ง ์ˆœ๋ฐœ๋ ฅ์ด ์ข‹๋‹ค. 

ํ€ด์ฆˆ ์‹œ๊ฐ„์ด ๋๋‚˜๊ณ ๋Š” Q&A ์‹œ๊ฐ„์ด ์žˆ์—ˆ๋‹ค. ์•ฝ๊ฐ„ ์ •๋ฆฌ๋ฅผ ํ•ด ๋ณด์ž๋ฉด,

1. ์‚ฌ์‹ค ๋ณธ๊ฒฉ์ ์œผ๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฐฐ์šฐ๋ ค๋ฉด JavaScript๋Š” ์ œ์•ฝ ์‚ฌํ•ญ์ด ์žˆ๋‹ค. ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋Œ€ํšŒ๋ฅผ ์ค€๋น„ํ•œ๋‹ค๋ฉด ํŒŒ์ด์ฌ, C++์„ ์‚ฌ์šฉํ•œ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ์—์„œ JavaScript๋ฅผ ์“ฐ๋Š” ๊ฒƒ์€ ์ƒ๊ด€ ์—†์œผ๋‹ˆ ๊ฑฑ์ •ํ•  ํ•„์š” ์—†๋‹ค.   

2. ๊ฐœ๋ฐœ์ž๋กœ์„œ ๋ฐฐ์šธ ์ง€์‹์ด ์ •๋ง ๋ฐฉ๋Œ€ํ•˜๋‹ค. ์–ด๋Š ํ•œ ๋ถ€๋ถ„์— ๊นŠ๊ฒŒ ์ง‘์ค‘ํ•˜๊ฒŒ ๋˜๋ฉด ์‹œ๊ฐ„์ด ์ •๋ง ๊ธˆ๋ฐฉ ๊ฐ„๋‹ค. ๊ทธ๋ž˜์„œ ๋ฐธ๋Ÿฐ์Šค๋ฅผ ๋งž์ถ”๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๋‹ค. ์–•๊ฒŒ ์—ฌ๋Ÿฌ ๋ฒˆ ๋ณด๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ๋‹ค.

3. ๊ทธ๋ฃน ๋ฆฌ๋ทฐ ์‹œ ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ์ฝ”๋“œ๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๊ฒƒ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, ๊ทธ ๋ฌธ์ œ๋ฅผ ํ’€๋ ค๊ณ  ์‹œ๋„ํ–ˆ๋˜ ๊ณผ์ •๊ณผ ์ƒ๊ฐ์˜ ํ๋ฆ„ ๋“ฑ์„ ๊ณต์œ ํ•˜๋„๋ก ํ•˜๋ผ.  

 

11:20~5:00 LeetCode Algorithms

LeetCode์—์„œ ํ•„์ˆ˜ ๋ฌธ์ œ 3๊ฐœ, ์ถ”๊ฐ€ ๋ฌธ์ œ 3๊ฐœ๋ฅผ ํ’€์–ด์•ผ ํ–ˆ๋‹ค. 6๋ฌธ์ œ ์ค‘ ๋ฌด๋ ค 4๋ฌธ์ œ๋‚˜ ์ฝ”์ฝ”์•„ ๊ณผ์ •์—์„œ ํ’€์—ˆ๋˜ ๋ฌธ์ œ์˜€๋‹ค. 11์›”์ฆˆ์Œ ํ’€์—ˆ๋˜ ๋ฌธ์ œ์—ฌ์„œ ๋‹ค์‹œ ๋ณด๋‹ˆ ์ƒˆ๋กญ๊ฒŒ ๋Š๊ปด์ง€๊ธฐ๋„ ํ–ˆ๋‹ค. ์–ด๋–ค ๊ฒƒ์€ ๋‹ค์‹œ ํ‘ผ ๋งŒํผ ์ •๋ง 5๋ถ„๋„ ์•ˆ ๊ฑธ๋ ค์„œ ํ‘ผ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๋ฐ˜๋ฉด, ์–ด๋–ค ๋ฌธ์ œ๋Š” ๋ถ„๋ช… ํ’€์—ˆ๋Š”๋ฐ๋„ ์˜ค๋ž˜ ๊ฑธ๋ ธ๋‹ค. ์ผ์ฃผ์ผ๋งŒ์— ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ๋ฅผ ํ‘ธ๋‹ˆ๊นŒ ์ข€ ์žฌ๋ฐŒ๊ธฐ๋„ ํ–ˆ๋‹ค. 6๋ฌธ์ œ๋ฅผ ๋‹ค ํ’€๊ณ , Linked List์™€ ๊ด€๋ จ๋œ ๋ฌธ์ œ๋ฅผ ํ•˜๋‚˜ ๋” ์‹œ๋„ํ•ด ๋ณด์•˜๋‹ค. ์ฝ”์ฝ”์•„์—์„œ ๋‚˜์™”๋˜ Merge two sorted list์ธ๋ฐ, ์—ญ์‹œ ์•„์ง๋„ ์–ด๋ ค์› ๋‹ค. ์ด๊ฑธ ํ’€๋‹ค๊ฐ€ ์žฌ๊ท€๋ฅผ ์ •๋ง ์ œ๋Œ€๋กœ ํ•™์Šต์„ ํ•ด์•ผ๊ฒ ๋‹ค๊ณ  ๋Š๊ผˆ๊ณ  ์žฌ๊ท€ ๊ณต๋ถ€๋ฅผ ์‹œ์ž‘ํ–ˆ๋‹ค. 

๋˜ Circular Linked List๋ฅผ ํ•™์Šตํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ๋„ ์žˆ์—ˆ๋‹ค. tail์ด ๋”ฐ๋กœ ์—†๋Š” ๋ง ๊ทธ๋Œ€๋กœ ์ˆœํ™˜์„ ํ•˜๋Š” ์‹์˜ Linked List์ธ๋ฐ ๋ฌธ์ œ๋ฅผ ํ’€๋ฉด์„œ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค. ๋‚˜์ค‘์— ์ด์— ๋Œ€ํ•ด์„œ๋„ ์ข€ ๋” ํ•™์Šต์„ ํ•ด์•ผ๊ฒ ๋‹ค. 

์˜ค๋Š˜์€ ์ฝ”๋“œ๋ฆฌ๋ทฐ๋Š” ๋”ฐ๋กœ ํ•˜์ง„ ์•Š์•˜๊ณ  ๊ทธ๋ƒฅ ํ’€๋ฉด์„œ ๋Š๋‚€ ์†Œ๊ฐ์„ ๊ฐ„๋‹จํžˆ ๊ณต์œ ํ–ˆ๋‹ค. ์•„๋ฌด๋ž˜๋„ ์ €๋ฒˆ ๋ฐฑ์ค€ ๋ฌธ์ œ์— ๋น„ํ•ด์„œ๋Š” ์กฐ๊ธˆ ๋œ ์–ด๋ ค์šด ๋ฌธ์ œ๋“ค๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์–ด์„œ ํŒจ์Šคํ•œ ๊ฒƒ๋„ ์žˆ๋Š” ๋“ฏ. ํ™•์‹คํžˆ ๋ฐฑ์ค€ ์‚ฌ์ดํŠธ๋ณด๋‹ค๋Š” ์‚ฌ์ดํŠธ UI๋‚˜, ํ†ต๊ณผํ•˜์ง€ ๋ชปํ–ˆ์„ ๋•Œ์˜ ์ผ€์ด์Šค๋ฅผ ์•Œ๋ ค์ฃผ๋Š” ๊ฒƒ์ด ์นœ์ ˆํ•˜๋‹ค๊ณ  ๋Š๊ปด์กŒ๋‹ค. 

'What I learned > CodeSquad Log' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

CodeSquad Day 10 : CS10 (4/10)  (0) 2022.01.15
CodeSquad Day 9 : CS10 (4/10)  (0) 2022.01.13
CodeSquad Day 7 : CS10 (3/10)  (0) 2022.01.12
CodeSquad Day 6 : CS10 (3/10)  (0) 2022.01.11
CodeSquad Day 5 : CS10 (2/10)  (0) 2022.01.08