본문 바로가기

반응형

전체 글

(501)
[리트코드] 200. Number of Islands - js (DFS) 1. 문제 https://leetcode.com/problems/number-of-islands/description/ Number of Islands - LeetCode Can you solve this real interview question? Number of Islands - Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent l leetcode.com 2. 코드 요소의 값이 숫자가 아니라 문자다.. /** *..
[리트코드] 20. Valid Parentheses - js 1. 문제 https://leetcode.com/problems/valid-parentheses/ 2. 코드 /** * @param {string} s * @return {boolean} */ var isValid = function(s) { if(s.length % 2) return false; let stack = []; for(let i=0;i
[리트코드] 394. Decode String - js 1. 문제 https://leetcode.com/problems/decode-string/ Decode String - LeetCode Can you solve this real interview question? Decode String - Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is g leetcode.com 2. 코드 /** * @param {string} s * @return {string} */ ..
[리트코드] 69. Sqrt(x) - js 1. 문제 https://leetcode.com/problems/sqrtx/ 2. 코드 /** * @param {number} x * @return {number} */ var mySqrt = function(x) { return Math.floor(Math.sqrt(x)); };
[리트코드] 17. Letter Combinations of a Phone Number - js (DFS) 1. 문제 https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Letter Combinations of a Phone Number - LeetCode Can you solve this real interview question? Letter Combinations of a Phone Number - Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of d leetcode.com 2. 코..
[리트코드] 875. Koko Eating Bananas - js (이진탐색) 1. 문제 https://leetcode.com/problems/koko-eating-bananas/ Koko Eating Bananas - LeetCode Can you solve this real interview question? Koko Eating Bananas - Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko can decide her bananas-per-hour eating sp leetcode.com 2. 코드 이진 탐색으로 문제 풀 때는 꼭 반올림, 내림 신경써주기! /..
[리트코드] 509. Fibonacci Number - js 1. 문제 https://leetcode.com/problems/fibonacci-number/ Fibonacci Number - LeetCode Can you solve this real interview question? Fibonacci Number - The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0 leetcode.com 2. 코드 /** * @param {number} n * @return {numbe..
[리트코드] 287. Find the Duplicate Number - js 1. 문제 https://leetcode.com/problems/find-the-duplicate-number/ Find the Duplicate Number - LeetCode Can you solve this real interview question? Find the Duplicate Number - Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number leetcode.com 2. 코드 /** * @param {number[]} n..

반응형