์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- ์ ์ด์ฝฅ ๋์จ
- ๋ฒ์ง ๋ชจํ
- BFS์ DFS
- git
- JavaScript
- wai-aria
- ๊ณ ์ฐจํจ์
- State
- css
- Cmarket
- ๋ฒ๋ค๋ง
- props drilling
- WEB
- fetch api
- ํ ์คํธ ์์
- ํ๋ก๊ทธ๋๋จธ์ค
- html
- prototype
- ํผํฐ ๋ชจ๋น
- ์คํ ์ด์ธ ์ฝ๋
- ์ปดํจํฐ ๊ณตํ
- css animation
- ์คํ ์ด์ธ ์ฝ๋42๊ธฐ
- React
- Effect Hook
- jsx
- ์๋งจํฑ์์
- Study
- Lifting state
- ํผํฐ ๋ชจ๋น์ ๋ฒ์ง ๋ชจํ
- Today
- Total
๋ชฉ๋ก๐ป Development/Study (23)
roqkf

๋ฌธ์ ๋ชฉ๋ก โค๏ธ๐ฅ ํ๋ฆฐํฐ function solution(priorities, location) { /* [{์ฐ์ ์์: ์ค์๋, ์ฒ์ ์ธ๋ฑ์ค: ์ธ๋ฑ์ค}, {์ฐ์ ์์: ์ค์๋, ์ฒ์ ์ธ๋ฑ์ค: ์ธ๋ฑ์ค}, {...}, ...] map์ ํตํด์ ํด๋น ๋ฐฐ์ด์ ๋ง๋ค์ด ์ค */ const priorityIdx = priorities.map((e, idx) => { return { priority: e, idx: idx, }; }); console.log(priorityIdx); /* ๋งจ์์ ์์๋ฅผ ๊บผ๋ด์ด ๊ธฐ์ค์ผ๋ก ์ผ์ some ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ๊ธฐ์ค์ ์ฐ์ ์์๋ณด๋ค ์ํํ๋ ์์๋ค ์ค ์ฐ์ ์์๊ฐ ๋ ๋์ ๊ฒ ์์ผ๋ฉด => true => ์ง๊ธ ๊ธฐ์ค์ด ๋๋ ๋ฌธ์(criteria)๋ฅผ ๋งจ๋ค๋ก ๋ณด๋ด๊ณ ์ฐ์ ์์๊ฐ ๋ ๋์ ๊ฒ ์..

๋ฌธ์ ๋ชฉ๋ก โค๏ธ๐ฅ n^2 ๋ฐฐ์ด ์๋ฅด๊ธฐ function solution(n, left, right) { /* ๊ฒฐ๊ณผ๋ ์ด์ฐจํผ ์ธ๋ฑ์ค left๋ถํฐ right๊น์ง ๋ฆฌํด์ด๋๊น ๋ฐ๋ณต ๋ฒ์๋ฅผ ๋ฆฌํด ๋ฒ์๋ก ์ค์ ํ๊ธฐ x๊ฐ => i % n y๊ฐ => i / n */ const arr = []; for (let i = left; i ์ฒซ๋ฒ์งธ ๊ธ์ ์ ๊ฑฐ ํ => t ์ฒ์๋ถํฐ p์ ๊ธธ์ด๋งํผ => ... ! p์ ๊ธธ์ด ํจํด์ด ๊ฐ์ ๋๊น์ง ๋ฐ๋ณตํด์ push ๊ทธ๋ ๊ฒ ๋ง๋ค์ด ์ค ๋ฌธ์์ด ํจํด ๋ฐฐ์ด์ ์ํํ๋ฉด์ Number ํ์ p๋ ๋น๊ตํด์ ? ์๊ฑฐ๋ ๊ฐ์ผ๋ฉด ํ์๋ฅผ cntํ๊ณ cnt ๋ฆฌํด */ function solution(t, p) { let cnt = 0; // t๋ฅผ p์ ๋น๊ตํ๊ธฐ ์ํ ๋ถ๋ถ๋ฌธ์์ด ๋ฐฐ์ด ๋ง๋ค์ด ์ฃผ๊ธฐ const pa..

โค๏ธ๐ฅ ํํ function solution(s) { /* 1. ์ค๊ดํธ๋ฅผ ์ ๊ฑฐํด ์ค๋ค. 2. ์์์ ๊ฐ์๋ฅผ ๊ฐ์ฒด๋ก count ํด ์ค๋ค 3. ์์ : ๊ฐ์์ ํํ๋ก ๋์จ ๊ฐ์ฒด์ ๊ฐ์ ๊ธฐ์ค์ผ๋ก sort ํด ์ค๋ค 4. map์ ํตํด 0๋ฒ์งธ์ ์๋ ๊ฒ์ ํค์ด๋ฏ๋ก ํค๋ง ๋ฝ์ number ํ์ ์ผ๋ก ๋ณํํ๋ค */ /* {{ }} ์ ๊ฑฐํด ์ฃผ๊ฒ ๋๋ฉด ์์ ์๋ ์ค๊ดํธ๋ค์ด ๋จ๋๋ฐ, ์์ ์ค๊ดํธ(},{) ๊ธฐ์ค์ผ๋ก ๋๋๋ฉด ๊ฐ ์งํฉ๋ผ๋ฆฌ ๋ฌถ์ ์ ์์ ์งํ ๋ด๋ถ์์๋ ๊ฐ ์์๋ผ๋ฆฌ ๋๋์ด์ฃผ๊ธฐ ์ํด ','๋ฅผ ๊ธฐ์ค์ผ๋ก ๋๋์ด ์ค๋ค */ s = s.slice(2, s.length-2).split('},{'); console.log(s) s = s.map((ele) => ele = ele.split(',')) console.log(s)..

๋ฌธ์ ๋ชฉ๋ก ๐ข ํ๋ ฌ์ ๊ณฑ์ function solution(arr1, arr2) { /* ๊ฐ ๋ฐฐ์ด๋ค๋ผ๋ฆฌ ํ๊ณผ ์ด์ ๊ณฑํ ๊ฐ์ ์๋ก์ด ๋ฐฐ์ด์ ๋ด์ ๋ฆฌํด์ํค๊ธฐ ๊ฒฐ๊ณผ ๋ฐฐ์ด์ arr1์ row ์ * arr2[0] ์์์ ์ ๊ฒฐ๊ณผ ๋ฐฐ์ด์ ๋ฏธ๋ฆฌ 0์ ์ฑ์ ๋ฃ๊ณ ํด๋นํ๋ ์ธ๋ฑ์ค์ ๊ฒฐ๊ณผ ๊ฐ์ ํ ๋นํ๋ ๋ฐฉ์์ผ๋ก ํ์ด๋ณด๊ธฐ */ console.log(arr1.length); console.log(arr2[0].length); let arr = Array.from(Array(arr1.length), () => Array(arr2[0].length).fill(0)); console.log(arr); for (let row1 = 0; row1 < arr1.length; row1++) { for (let col = 0; col ..

๋ฌธ์ ๋ชฉ๋ก โค๏ธ๐ฅ ๋ฉ๋ฆฌ ๋ฐ๊ธฐ function solution(n) { // ๊ฒฝ์ฐ์ ์?? // n๊น์ง์ ํผ๋ณด๋์น ์์ด์ ๊ตฌํ๊ณ 1234567 ๋๋ ๋๋จธ์ง ๋ฆฌํด let fibo = [0, 1]; for (let i = 2; i 1 ! 1 ๋ฐฉ๋ฒ = 1 2 => 1, 1 / 2 = 2 ! 2 ๋ฐฉ๋ฒ = 2 3 => 1, 1, 1 / 2, 1 / 1, 2 = 3 ! 3 ๋ฐฉ๋ฒ = 3 4 => 1, 1, 1, 1 / 2, 2 / 2, 1, 1 / 1, 2, 1 / 1, 1, 2 = 5 ! 4 ๋ฐฉ๋ฒ = 5 5 => 1, 1, 1, 1, 1 / 2, 2, 1 / 2, 1, 2 / 1, 2, 2 / 2, 1, 1, 1 / 1, 2, 1, 1 / 1, 1, 2, 1 / 1, 1, 1, 2 ! 5 ๋ฐฉ๋ฒ = 8 6 => 1,..

๋ฌธ์ ๋ชฉ๋ก โค๏ธ๐ฅ ์ง์ง์ด ์ ๊ฑฐํ๊ธฐ function solution(s) { let word = []; // ์คํ์ผ๋ก ๋ฃ์ด์ ๋ง์ง๋ง๊ณผ ๋ง์ง๋ง+1๊ฐ ๊ฐ์ผ๋ฉด ๋นผ์ฃผ๊ธฐ // ๊ฒฐ๊ณผ์ ์ผ๋ก ๋ด์๋๋ word์ ์๋ฌด๊ฒ๋ ์์ผ๋ฉด, ์ง์ง์ด ์ ๊ฑฐํ๊ธฐ๊ฐ ์ฑ๊ณต๋ ๊ฒ์ด๋ฏ๋ก 1๋ฆฌํด for (let i = 0; i = 2 && word.at(-1) === word.at(-2)) { word.pop(); word.pop(); } } return !word.length ? 1 : 0; } solution('baabaa'); ์คํ์ ์ด์ฉํด์ ํ์๋ค! ์คํํ๋ฉด ์์ ์ ํ์๋ ํ๋ฒ๊ฑฐ ๋ง๋ค๊ธฐ๋ฐ์ ์๊ฐ์ด ์๋.. function solution(s){..