[Python] ์ˆ˜ํ–‰ ์‹œ๊ฐ„ ์ธก์ • ์†Œ์Šค์ฝ”๋“œ
ยท
Algorithm/์ด๊ฒƒ์ด ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ๋‹ค
import time start_time = time.time() # ์ธก์ • ์‹œ์ž‘ # ํ”„๋กœ๊ทธ๋žจ ์†Œ์Šค์ฝ”๋“œ end_time = time.time() # ์ธก์ • ์ข…๋ฃŒ print("time :", end_time - start_time) # ์ˆ˜ํ–‰ ์‹œ๊ฐ„ ์ถœ๋ ฅ
[React] React Router(๋ฆฌ์•กํŠธ ๋ผ์šฐํ„ฐ) ์‚ฌ์šฉํ•˜๊ธฐ
ยท
Frontend/React
SPA ๊ธฐ๋ฒ•์„ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•œ ์ƒํƒœ๋กœ REACT์—์„œ ํŽ˜์ด์ง€ ์ด๋™ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ React Router๊ฐ€ ์‚ฌ์šฉ๋œ๋‹ค. ๋ผ์šฐํŒ…์ด๋ž€? - ์‚ฌ์šฉ์ž๊ฐ€ ์š”์ฒญํ•œ URL์— ๋”ฐ๋ผ ํ•ด๋‹น URL์— ๋งž๋Š” ํŽ˜์ด์ง€๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์‰ฝ๋‹ค. - ๋ฆฌ์•กํŠธ์—๋Š” ๋ผ์šฐํŒ… ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์กด์žฌํ•˜๋Š”๋ฐ, ๊ทธ ์ค‘ ๋ฆฌ์•กํŠธ ๋ผ์šฐํ„ฐ(React Router)๋ฅผ ์‚ฌ์šฉํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค. React Router(๋ฆฌ์•กํŠธ ๋ผ์šฐํ„ฐ)๋ž€ ๋ฌด์—‡์ธ๊ฐ€? - ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ์ฃผ์†Œ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ์—ญํ• ์„ ํ•˜๋ฉฐ, ์—ฌ๋Ÿฌ ํ™˜๊ฒฝ์—์„œ ๋™์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ์—ฌ๋Ÿฌ ์ข…๋ฅ˜์˜ ๋ผ์šฐํ„ฐ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ œ๊ณตํ•œ๋‹ค. ์ข…๋ฅ˜ - BrowserRouter: HTML5๋ฅผ ์ง€์›ํ•˜๋Š” ๋ธŒ๋ผ์šฐ์ €์˜ ์ฃผ์†Œ๋ฅผ ๊ฐ์ง€ํ•œ๋‹ค. - HashRouter: ํ•ด์‹œ ์ฃผ์†Œ๋ฅผ ๊ฐ์ง€ํ•œ๋‹ค. React Router(๋ฆฌ์•กํŠธ ๋ผ์šฐํ„ฐ) ์‚ฌ์šฉํ•ด๋ณด๊ธฐ! (โ— ..
[React] SPA(Single Page Application) ์ด๋ž€?
ยท
Frontend/React
SPA๋ฅผ ์„ค๋ช…ํ•˜๊ธฐ ์ „ SPA๋ฅผ ์™œ ์‚ฌ์šฉํ•˜๋Š”์ง€? ์ „ํ†ต์ ์ธ ์›น ์‚ฌ์ดํŠธ๋Š” ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋ฅผ ์š”์ฒญํ•  ๋•Œ๋งˆ๋‹ค ์ •์  ๋ฆฌ์†Œ์Šค๊ฐ€ ๋‹ค์šด๋กœ๋“œ๋˜๊ณ  ์ „์ฒด ํŽ˜์ด์ง€๋ฅผ ๋‹ค์‹œ ๋ Œ๋”๋ง ํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ์ƒˆ๋กœ๊ณ ์นจ์ด ๋ฐœ์ƒ๋˜์–ด ์‚ฌ์šฉ์„ฑ์ด ์ข‹์ง€ ์•Š์œผ๋ฉฐ, ๋ณ€๊ฒฝ์ด ํ•„์š”์—†๋Š” ๋ถ€๋ถ„์„ ํฌํ•จํ•˜์—ฌ ์ „์ฒด ํŽ˜์ด์ง€๋ฅผ ๊ฐฑ์‹ ํ•˜๋ฏ€๋กœ ๊ต‰์žฅํžˆ ๋น„ํšจ์œจ์ ์ด๋‹ค. ์›น ์‚ฌ์ดํŠธ์˜ ๊ทœ๋ชจ๊ฐ€ ์ปค์งˆ์ˆ˜๋ก ์„œ๋ฒ„์ชฝ์—์„  ๊ณผ๋ถ€ํ•˜๊ฐ€ ๊ฑธ๋ฆด ์ˆ˜ ๋ฐ–์— ์—†๋‹ค. ๊ทธ ๋งŒํผ ์†๋„์ ์ธ ์ธก๋ฉด์—์„œ ์‚ฌ์šฉ์ž๋Š” ๋ถˆํŽธํ•จ์„ ๊ทธ๋Œ€๋กœ ๋Š๋ผ๊ฒŒ ๋œ๋‹ค. ํ‹€๋ฆดํ™•๋ฅ ์ด ๋†’์€ ๊ฐœ์ธ์ ์ธ ์ง€์‹(์ˆ˜์ • ๊ฐ€๋Šฅ์„ฑ ๋†’์Œโ—) Traditional Page Lifecycle HTML → CSS → DOM → Web browser SPA Lifecycle HTML → CSS → Virtual Dom → DOM(ํ•„์š” ์š”์†Œ๋งŒ ๋ณ€๊ฒฝ) → Web browser..
[Netlify] Netlify ๋ฐฐํฌํ•˜๋Š” ๋ฐฉ๋ฒ•
ยท
Netlify
1. ํ•ด๋‹น ํ”„๋กœ์ ํŠธ ๊ฒฝ๋กœ๋กœ ๋“ค์–ด๊ฐ„๋‹ค.c: \projects\...\ํ”„๋กœ์ ํŠธ ๊ฒฝ๋กœ 2.  npm์„ ์ด์šฉํ•ด Netlify ํŒŒ์ผ์„ ๊ธ€๋กœ๋ฒŒ์ ์œผ๋กœ ์„ค์น˜$ npm install netlify-cli -g 3.  Netlify ๋ช…๋ น์–ด ์‹คํ–‰$ netlify deploy 4. What would you like to do? (๋ฐฉํ–ฅํ‚ค๋ฅผ ์ด์šฉํ•˜์—ฌ ์„ ํƒ)+ Create & configure a new site 5. Team & Site name ์ž…๋ ฅ? Site name: Seongho's team? Site name: seongho-site-name 6. build ํด๋”๋ฅผ deploy (์ฃผ์˜โ— build ํด๋”๊ฐ€ ์—†๋‹ค๋ฉด $ npm run build๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ)? Publish directory build 7. ์ƒ์„ฑ๋œ draf..
[Node.js/JavaScript] ๋ฐฑ์ค€ 1157๋ฒˆ ๋‹จ์–ด ๊ฐœ์ˆ˜
ยท
Algorithm/๋ฐฑ์ค€(BOJ)
๋ฌธ์ œ ์•ŒํŒŒ๋ฒณ ๋Œ€์†Œ๋ฌธ์ž๋กœ ๋œ ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์ง€๋ฉด, ์ด ๋‹จ์–ด์—์„œ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ๋œ ์•ŒํŒŒ๋ฒณ์ด ๋ฌด์—‡์ธ์ง€ ์•Œ์•„๋‚ด๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ๋‹จ, ๋Œ€๋ฌธ์ž์™€ ์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š๋Š”๋‹ค. ํ’€์ด const input = require('fs').readFileSync('์˜ˆ์ œ.txt').toString().trim().toUpperCase(); // 26์˜ ๊ธธ์ด๋ฅผ ๊ฐ€์ง„ ๋นˆ ๋ฐฐ์—ด์— 0์„ ์ฑ„์›Œ์„œ ๋ฐฐ์—ด ๊ฐ์ฒด ์ƒ์„ฑ const arr = new Array(26).fill(0); // ๋ฌธ์ž A์˜ ์ธ๋ฑ์Šค = 0 (UTF-16 ์ฝ”๋“œ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ •์ˆ˜ - 65) for (let i = 0; i < input.length; i++) { arr[input.charCodeAt(i) - 65]++; } // ๋ฐฐ์—ด ์•ˆ์—์„œ ์ตœ๋Œ“๊ฐ’ ์ฐพ๊ธฐ const max =..
[React] React.PureComponent(์„ฑ๋Šฅ ํ–ฅ์ƒ)
ยท
Frontend/React
PureComponent & memo Component์— state๋‚˜ props์— ๋ณ€ํ™”๊ฐ€ ์—†๋‹ค๋ฉด render ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜์ง€ โŒ React.PureComponent React.PureComponent๋Š” React.Component์™€ ๋น„์Šทํ•˜๋‹ค. React.Component๋Š” shouldComponentUpdate()๋ฅผ ๊ตฌํ˜„ํ•˜์ง€ ์•Š์ง€๋งŒ, React.PureComponent๋Š” props์™€ state๋ฅผ ์ด์šฉํ•œ ์–•์€ ๋น„๊ต(๋ ˆํผ๋Ÿฐ์Šค๋งŒ ๋น„๊ตํ•ด์„œ ์•ˆ์— ๋ฐ์ดํ„ฐ๊ฐ€ ๋‹ฌ๋ผ์ ธ๋„ ๋™์ผํ•œ ์˜ค๋ธŒ์ ํŠธ)๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค๋Š” ์ฐจ์ด์ ๋งŒ์ด ์กด์žฌํ•œ๋‹ค. ์ฐธ์กฐ๊ฐ’์ด ๋™์ผํ•˜๋ฉด ์—…๋ฐ์ดํŠธ โŒ => ShouldComponentUpdate ํ•จ์ˆ˜๋Š” false๋ฅผ ๋ฆฌํ„ด React ์ปดํฌ๋„ŒํŠธ์˜ render() ํ•จ์ˆ˜๊ฐ€ ๋™์ผํ•œ props์™€ state์— ๋Œ€ํ•˜์—ฌ ๋™์ผํ•œ ๊ฒฐ๊ณผ๋ฅผ ๋ Œ..
[Node.js/JavaScript] ๋ฐฑ์ค€ 10809๋ฒˆ ์•ŒํŒŒ๋ฒณ ์ฐพ๊ธฐ
ยท
Algorithm/๋ฐฑ์ค€(BOJ)
๋ฌธ์ œ ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ๋‹จ์–ด S๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๊ฐ๊ฐ์˜ ์•ŒํŒŒ๋ฒณ์— ๋Œ€ํ•ด์„œ, ๋‹จ์–ด์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” ๊ฒฝ์šฐ์—๋Š” ์ฒ˜์Œ ๋“ฑ์žฅํ•˜๋Š” ์œ„์น˜๋ฅผ, ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ์—๋Š” -1์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ํ’€์ด const input = require('fs').readFileSync('์˜ˆ์ œ.txt').toString().trim().split(''); let result = ''; // UTF-16 ์ฝ”๋“œ ์œ ๋‹›์˜ ์‹œํ€€์Šค๋กœ๋ถ€ํ„ฐ a - z ๋ฌธ์ž๋ฅผ ์ƒ์„ฑํ•œ ํ›„ ํ•ด๋‹น ๋ฌธ์ž์˜ ์ธ๋ฑ์Šค๋ฅผ ๋ฐ˜ํ™˜ // ํ•ด๋‹น ๋ฌธ์ž๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด -1์„ ๋ฐ˜ํ™˜ for (let i = 97; i
[React] React ์‚ฌ์šฉํ•  ๋•Œ ์•Œ๊ณ  ์žˆ์œผ๋ฉด ์ข‹์„ ๊ฒƒ!
ยท
Frontend/React
React ์•ฑ ๋งŒ๋“ค๊ธฐ $ yarn create react-app ํด๋” ์ด๋ฆ„ โ— ํด๋” ์ด๋ฆ„์— ๊ณต๋ฐฑ์ด ๋“ค์–ด ์žˆ์ง€ ์•Š๋„๋ก ํ•ด์•ผํ•œ๋‹ค. ํ…œํ”Œ๋ฆฟ ํด๋” ⇒ ์ƒˆ๋กœ์šด ํด๋” $ cp -R [ํ…œํ”Œ๋ฆฟ ํด๋”] [์ƒˆ๋กœ์šด ํด๋”] โ— ํ…œํ”Œ๋ฆฟ ํด๋”๊ฐ€ ๋“ค์–ด์žˆ๋Š” ๊ฒฝ๋กœ๋กœ ์„ค์ •ํ•ด์•ผ ํ•œ๋‹ค. fontawesome ์‚ฌ์šฉํ•˜๊ธฐ cmder $ yarn add @fortawesome/fontawesome-free index.js import '@fortawesome/fontawesome-free/js/all.js'; ์ปดํฌ๋„ŒํŠธ ๊ณจ๊ฒฉ ์ƒ์„ฑ // Class Component rcc + Tab // function Component rsi + Tab axios ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€ // $ yarn add ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ $ yarn add axios
_์„ฑํ˜ธ_
๐ŸŒฑ ์„ฑํ˜ธ ๋ธ”๋กœ๊ทธ