본문 바로가기

LeetCode - Top Interview 150

(30)
[Java Script] 909. Snakes and Ladders 1. 문제 개요 문제 링크 : 909. Snakes and Ladders LeetCode - The World's Leading Online Programming Learning Platform 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 여러 장애물이 있는 길을 통과하여 목표에 도달하는 최소횟수를 찾는 문제 2. 문제 풀이 LeetCode 요구 양식으로 코드 구현 /** * @param {number[][]} board * @return {number} */ var snak..
[Java Script] 133. Clone Graph 1. 문제 개요 문제 링크 : 133. Clone Graph LeetCode - The World's Leading Online Programming Learning Platform 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 그래프 기능 구현 2. 문제 풀이 그래프 기능을을 구현하면되는 간단한 문제입니다. 그래프에대한 이해도가 중요합니다. LeetCode 요구 양식으로 코드 구현 var cloneGraph = function (node, clonedNodes = new Ma..
[Java Script] 373. Find K Pairs with Smallest Sums 1. 문제 개요 문제 링크 : 373. Find K Pairs with Smallest Sums Find K Pairs with Smallest Sums - LeetCode Can you solve this real interview question? Find K Pairs with Smallest Sums - You are given two integer arrays nums1 and nums2 sorted in non-decreasing order and an integer k. Define a pair (u, v) which consists of one element from the first array and one leetcode.com 오름 차순으로 구성된 두개의 배열과 정수 k 가 주어집니다..
[Java Script] 215. Kth Largest Element in an Array 1. 문제 개요 문제 링크 : 215. Kth Largest Element in an Array Kth Largest Element in an Array - LeetCode Can you solve this real interview question? Kth Largest Element in an Array - Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct eleme leetcode.com 주어진 배열에서 k번째로 큰값의 인덱스를 반환하는 문제 ..
[Java Script] 212. Word Search II 1. 문제 개요 문제 링크 : 212. Word Search II Word Search II - LeetCode Can you solve this real interview question? Word Search II - Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are leetcode.com 주어진 문자열을 활용하여 n 차열 배열을 표로 구성하고(빙고판과 같이) 해당 표의 인접값을 활용하여 주어진 단어중 구성..
[Java Script] 211. Design Add and Search Words Data Structure 1. 문제 개요 문제 링크 : 211. Design Add and Search Words Data Structure Design Add and Search Words Data Structure - LeetCode Can you solve this real interview question? Design Add and Search Words Data Structure - Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: * WordDictionar leetcode.com 트리 구조를 이용..
[Java Script] 208. Implement Trie (Prefix Tree) 1. 문제 개요 문제 링크 : 208. Implement Trie (Prefix Tree) Implement Trie 구현 검색하려는 단어가 존재할시 true 없을시 false 반환 startWith 기능 구현(LIKE) 2. 문제 풀이 트리의 기능을 구현하는 문제이기에 기본적이 트리 기능을 구현후 테스트를 진행했습니다. 트리에 대해 이해하고 있느냐의 문제이기에 주석을 사용한 구조는 생략합니다. LeetCode 요구 양식으로 코드 구현 class TrieNode { constructor() { this.children = {} this.endWord = false } } var Trie = function() { this.root = new TrieNode() }; Trie.prototype.insert..
[Java Script] 637. Average of Levels in Binary Tree 1. 문제 개요 문제 링크 : 637. Average of Levels in Binary Tree Average of Levels in Binary Tree - LeetCode Can you solve this real interview question? Average of Levels in Binary Tree - Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within 10-5 of the actual answer will be accepted. Examp leetcode.com 주어진 이진 트리에서 각 레벨별 평균값을 반환하시오 2. ..
[Java Script] 199. Binary Tree Right Side View 1. 문제 개요 문제 링크 : 199. Binary Tree Right Side View Binary Tree Right Side View - LeetCode Can you solve this real interview question? Binary Tree Right Side View - Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 1: [https://asse leetcode.com 이진 트리가 주어지면 맨 우측에 있는값들만 반환하는 문제입니다. (그림참고)..
[Java Script] 230. Kth Smallest Element in a BST 1. 문제 개요 문제 링크 : 230. Kth Smallest Element in a BST Kth Smallest Element in a BST - LeetCode Can you solve this real interview question? Kth Smallest Element in a BST - Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. Example 1: [https://assets.leetco leetcode.com 주어진 이진트리 내에서 주어진 k 번째로 작은 수의 인덱스를 반환하시..