JSON.stringify ์ ์ฌ์ฉํ์ง ์๊ณ ๋ Object๊ฐ ๊ฐ์์ง ๋น๊ต(deep-equal) Deep Equality checking of Two Objects function compareObjectsDeepEqual(original, target) { const isObject = obj => typeof obj === "object" && obj !== null; if (!isObject(original) || !isObject(target)) { return original === target; } const keysOfOriginal = Object.keys(original); const keysOfTarget = Object.keys(target); if (keysOfOriginal.len..
Dutch national flag problemarray[0] ~ [low-1] zeros (red) array[low] ~ [mid-1] onew (white) array[mid] ~ [high] unknown array[high+1] ~ [length-1] twos (blue)์ฒ์์ ๋ชจ๋ ์์๋ unknown ์ํ์ด๊ธฐ ๋๋ฌธ์ low = 0mid = 0high = length-1์ด๋ค. 75. Sort ColorsGiven an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white..
BST ์ด๋ฏธ sorted ๋ ๋ฐ์ดํฐ์ ๊ฒฝ์ฐ, BST๋ฅผ ์ด์ฉํด O(log n)์ ์๊ฐ๋ณต์ก๋๋ก ํ๊ฒ์ ์ฐพ์ ์ ์๋ค. 34. Find First and Last Position of Element in Sorted Array Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. Example 1: Input: nums =..
Linked List + Merge SortMerge sort์ ๊ธฐ๋ณธ๊ฐ๋ ์ Divide and conquer์ด๋ค. ๋ฐ๋ผ์ Quick sort์ ๋ง์ฐฌ๊ฐ์ง๋ก ์ฌ๊ท๋ฅผ ํตํด ๊ตฌํ ํ ์ ์๋ค. ์ด๋ฏธ ์ ๋ ฌ๋ ๋ ํํฐ์ ๋ค์ด ์๋ค๋ฉด, ๋ ํํฐ์ ์ ์ฒซ์์๋ฅผ ๊ฒ์ฌํ์ฌ ๋ ์์ ์์๋ฅผ ๋บ๋ค.Linked List ์ ์ฐ๊ฒฐํ์ฌ์ ํธ๋ ๋ฌธ์ ์ด๊ธฐ๋๋ฌธ์ ๋ ์์ ์์๋ฅผ ๊ฐ์ง๊ณ ์๋ ๋ง๋ฆฌ๋ฅผ ํค๋๋ก ์ผ๊ณ , ํค๋๋ก ์ผ์ ๋ง๋ฆฌ์ ๋ค์ ๋ ธ๋์, ํค๋๊ฐ ๋์ง๋ชปํ ๋ง๋ฆฌ ๋๊ฐ์ง๋ฅผ ๋ค์ ํจ์์ ๋ฃ๋๋ค.21. Merge Two Sorted ListsMerge two sorted linked lists and return it as a new sorted list.The new list should be made by splicing together..
ํ๋์ async function ๋ด์์๋ await ํค์๋๋ฅผ ๋ง๋ ๋๋ง๋ค ๋ง ๊ทธ๋๋ก ๊ธฐ๋ค๋ ธ๋ค๊ฐ(await) ๋น๋๊ธฐ์ฒ๋ฆฌ๊ฐ ์๋ฃ ๋ ํ ์ง๋ ฌ๋ก ๋ค์ task๋ฅผ ์ฒ๋ฆฌํ๋ค. ๋ง์ฝ์ async ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ตฌํํ๋ ๊ณผ์ ์ค์ each๋ times ์ฒ๋ผ ์ฌ๋ฌ ๋น๋๊ธฐ task๋ฅผ ๋ณ๋ ฌ์ ์ผ๋ก ์์์ํค๋ ค๋ฉด ์ด๋ป๊ฒ ํด์ผํ ๊น? ๋ง์ฝ Promise.all ๊ฐ ๋ณ๋ ฌ๋ก ๋์ํ๋ค๋ฉด ์๊ฑธ ์ฐ๋ฉด ๋ ๊ฒ ๊ฐ๋ค!! ๊ทธ๋์ ํ๋ฒ ํ์ธํด๋ณด์๋ค. โ async/await ์ง๋ ฌ์ฒ๋ฆฌ function nSecondsLater(n) { console.log(`๐ฉ n=${n} Start`); return new Promise((resolve, reject) => { setTimeout(() => { resolve(`โ ${n} Seconds Later..
- ์์ฑ์ํจ์
- DOM
- Stash
- HTML
- VSC
- GIT
- ๋ฐ๋๋ผ์ฝ๋ฉ
- ๋ฐ๋๋ผ์ฝ๋ฉ ํ๊ธฐ
- js
- KEYBOARD
- stackoverflow
- review
- eslint
- string
- book
- eventlistener
- array
- ์ฝ๋ฉ๋ถํธ์บ ํ
- ๋ถํธ์บ ํ
- css
- Total
- Today
- Yesterday