[Medium] 77. Combinations
leetCode 2022. 5. 19. 11:56

문제 Given two integers n and k, return all possible combinations of k numbers out of the range [1, n]. You may return the answer in any order. 예시 Example 1: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] Example 2: Input: n = 1, k = 1 Output: [[1]] 제약 조건 Constraints: 1

[Medium] 994. Rotting Oranges
카테고리 없음 2022. 5. 17. 17:35

문제 You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must elapse until no cell has a fresh orange. If this is impossible, return -1. 예시 x..

[Medium] 542. 01 Matrix
leetCode 2022. 5. 17. 14:56

문제 Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. 예시 Example 1: Input: mat = [[0,0,0],[0,1,0],[0,0,0]] Output: [[0,0,0],[0,1,0],[0,0,0]] Example 2: Input: mat = [[0,0,0],[0,1,0],[1,1,1]] Output: [[0,0,0],[0,1,0],[1,2,1]] 제약 조건 Constraints: m == mat.length n == mat[i].length 1

2장. 리팩터링 원칙
리팩터링 2판 2022. 5. 16. 23:36

리팩터링 정의 리팩터링 : 소프트웨어의 겉보기 동작은 그대로 유지한 채, 코드를 이해하고 수정하기 쉽도록 내부 구조를 변경하는 기법 왜(why) : 이해하고 수정하기 쉬운 코드 무엇을 (what) : 내부 구조를 변경 어떻게 (how) : 겉보기 동작은 그대로 유지한 채 겉보기 동작의 유지란? 예시 : 함수 매개변수화 하기 function tenPercentRaise(aPerson){ aPerson.salary = aPerson.salary.multiply(1.1); } function fivePercentRaise(aPerson){ aPerson.salary = aPerson.salary.multiply(1.05); } ↓ function raise(aPerson, factor){ aPerson.sal..

04장 변수, 05장 표현식과 문
모던 자바스크립트 Deep Dive 2022. 5. 16. 22:37

변수 이름은 어디에 등록되는가? 변수 이름을 비롯한 모든 식별자는 실행 컨텍스트에 등록된다. 실행 컨텍스트(execution context)는 자바스크립트 엔진이 소스코드를 평가하고 실행하기 위해 필요한 환경을 제공하고 코드의 실행 결과를 실제로 관리하는 영역이다. 자바스크립트 엔진은 실행 컨텐스트를 통해 식별자와 스코프를 관리한다. 변수 이름과 변수 값은 실행 컨텍스트 내에 키(key) / 값 (value) 형식인 객체로 등록되어 관리된다. 자바스크립트 엔진이 변수를 관리하는 메커니즘은 13장 "스코프"와 23장 "실행 컨텍스트"에서 자세히 살펴볼 것이다. 지금은 단순히 자바스크립트 엔진이 변수를 관리할 수 있도록 변수의 존재를 알린다는 정도로만 알아두자. WeakRef() ES2021에서 나온 새로운..

[Medium] 116. Populating Next Right Pointers in Each Node
leetCode 2022. 5. 16. 16:17

https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ Populating Next Right Pointers in Each Node - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 You are given a perfect binary tree where all leaves are on the same level, and every parent has two children...

[Easy] 617. Merge Two Binary Trees
leetCode 2022. 5. 16. 15:57

https://leetcode.com/problems/merge-two-binary-trees/ Merge Two Binary Trees - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 : You are given two binary trees root1 and root2. Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped w..

2022.05.09 JavaScript 기본 '프로토타입'을 배웠다! [제로베이스 프론트엔드 스쿨 3기]
카테고리 없음 2022. 5. 9. 20:37

오늘은 새 스터디원들이 들어오고 난 첫 날~! 같이 열심히 할 사람들이 늘어나서 너무 좋다. 오늘은 HTML 미션 2 마무리 했다. 해결하기 힘들었던 부분이 background로 아이콘 넣기, 별점 사진 자르기 두 개 였는데 마지막까지 해결하지 못한 건 나중에 다시 보니 클래스 이름을 잘못 써서 적용이 안 됐던 거였다😂... 그래도 해결했으니 뿌듯하다! 과제를 하느라 모각코 시간을 다 써버려서 강의는 조금밖에 듣지 못했다😅 오늘 공부한 내용 JavaScript 기본 프로토타입 1. 프로토타입이란? 2. constructor 3. __proto__ 4. 프로토타입 체인 5. 프로토타입 확장 1. 프로토타입이란? 자바스크립트는 프로토타입을 기반으로 동작한다. 모든 자바스크립트는 프로토타입을 가지고 있다. 2..