전체 글

전체 글

    LeetCode / Stack / 844번 / Backspace String Compare / JS

    Backspace String Compare - LeetCode Can you solve this real interview question? Backspace String Compare - Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character. Note that after backspacing an empty text, the tex leetcode.com 문자열 s와 t가 주어진다. 문자열에 #이 있다면 이전에 입력한 문자는 지워진다. 예를들면, "ab#c" 일 경우엔 a를 ..

    Symbol

    1. Symbol 이란? Symbol은 원시타입 데이터로, 유일무이한 값을 만드는데 사용된다. (Symbol의 뜻이 상징이라는 뜻이니까...) 그리고 이 값은 익명의 객체 속성(object property)을 만들 수 있는 특성을 가졌다. 한 마디로 객체의 키값은 문자열, 뿐만 아니라 Symbol형도 가능하다. Symbol() 을 사용하면 Symbol 값을 만들 수 있다. // id는 새로운 심볼이 됩니다. let id = Symbol(); 아래와 같이 Symbol을 만들 때 인자를 줄 수 있는데, 이 인자는 Symbol을 나타내는 설명, 이름이다. 이 Symbol 이름은 어떠한 것에도 영향을 주지 않는 단순 '이름'역할만 한다. 디버깅시에 많이 쓰인다. // 심볼 id에는 "id"라는 설명이 붙습니다...

    LeetCode / Binary Search Tree / 235번 / Lowest Common Ancestor of a Binary Search Tree / JS

    Lowest Common Ancestor of a Binary Search Tree - LeetCode Can you solve this real interview question? Lowest Common Ancestor of a Binary Search Tree - Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on Wikipedia [https: leetcode.com TreeNode인 p와 q가 주어지는데, p와 q의 가장 가까운 공통 부모노드를 찾..

    LeetCode / Binary Search Tree / 98번 / Validate Binary Search Tree / JS

    Validate Binary Search Tree - LeetCode Can you solve this real interview question? Validate Binary Search Tree - Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: * The left subtree of a node contains only nodes with keys le leetcode.com 주어진 Tree가 유효한 BST(Binary Search Tree)인지 확인해서 boolean 값을 반환하는 문제이다..

    LeetCode / Binary Search / 278번 / First Bad Version / JS

    First Bad Version - LeetCode Can you solve this real interview question? First Bad Version - You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed base leetcode.com 나쁜 버전인지 판단해서 boolean 값으로 반환하는 api가 isBadVersion 라는 이름으로 주어진다. 만약 n번째 버전이 나쁜..

    LeetCode / Binary Search / 704번 / Binary Search / JS

    Binary Search - LeetCode Can you solve this real interview question? Binary Search - Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. leetcode.com 주어진 nums 배열에서 target의 값이 몇번째 인덱스에 존재하는지 이분탐색으로 찾는 문제이다. /** * @param {number[]}..