반응형
SMALL

전체 글 130

[LeetCode] BFS-DFS 207. Course Schedule (feat. 위상정렬(Topological Sort))

문제 There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, return ..

Coding Interview 2022.09.25

[LeetCode] BFS-DFS 236. Lowest Common Ancestor of a Binary Tree

문제 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).” Example 1: Input: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1 Outpu..

Coding Interview 2022.09.24

리액트에 멀티스레드(Multi-Thread) 도입하기(feat. worker-plugin)

webpack5에서부터는 worker-plugin을 설치하지 않아도 worker-plugin을 이용할 수 있습니다.(자동으로 컴파일) 따라서 직접 worker-plugin을 설치해서 webpack에 적용하면 다음과 같은 에러를 만납니다 Module parse failed: ParserHelpers.addParsedVariableToModule is not a function 따라서 다음과 같이 해줍니다. // 이 라이브러리는 원하는 RPC와 같은 경험을 제공한다. // worker-plugin에 wrap해서 사용 yarn add comlink // App.css body { margin: 0; overflow: hidden; font-size: 3rem; } button { font-size: 1.2re..

React 2022.09.22

브라우저 동작원리(= 렌더링 과정) + 리액트의 원리

https://mine-it-record.tistory.com/577 DOM(Document Object Model) 생성 - 생명주기: DOMContentLoaded, load, beforeunload, unload 1. DOMContentLoaded => DOM 트리 완성 즉시 발생함. => img 및 CSS 등 외부 자원 기다리지 않음 => 여러 스크립트 태그가 존재한다면 => 모든 스크립트가 실행된 이후 DOMContentLoaded가 실행됨 (이유: DOMContentLoaded에 DOM 조작 관련 로직이 있을 수 있기 때문) // a // b // c // 실행순서 b => c => a => document.createElement('script')로 동적으로 생성되고 웹페이지에 추가된 스크립..

JavaScript 2022.09.21
반응형
LIST