본문 바로가기

반응형

리트코드/midium

(32)
[리트코드] 438. Find All Anagrams in a String - js (sliding window) 1. 문제 https://leetcode.com/problems/find-all-anagrams-in-a-string/description/ Find All Anagrams in a String - LeetCode Can you solve this real interview question? Find All Anagrams in a String - Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order. An Anagram is a word or phrase formed by rearrangi leetcode.com 2. 코드 이 ..
[리트코드] 34. Find First and Last Position of Element in Sorted Array - js (투포인터) 1. 문제 https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Find First and Last Position of Element in Sorted Array - LeetCode Can you solve this real interview question? Find First and Last Position of Element in Sorted Array - Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target..
[리트코드] 73. Set Matrix Zeroes - js (queue) 1. 문제 https://leetcode.com/problems/set-matrix-zeroes/ Set Matrix Zeroes - LeetCode Can you solve this real interview question? Set Matrix Zeroes - Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's. You must do it in place [https://en.wikipedia.org/wiki/In-place_algorithm]. Example 1: [https leetcode.com 2.코드 /** * @param {number[][]} matrix * @return..
[리트코드] 300. Longest Increasing Subsequence - js (DP) 1. 문제 https://leetcode.com/problems/longest-increasing-subsequence/description/ Longest Increasing Subsequence - LeetCode Can you solve this real interview question? Longest Increasing Subsequence - Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest leetcode.com 2. 코드 정답 ..
[리트코드] 994. Rotting Oranges - js (BFS) 1. 문제 https://leetcode.com/problems/rotting-oranges/description/ Rotting Oranges - LeetCode Can you solve this real interview question? Rotting Oranges - 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 leetcode.com 2. 코드 처음 작성한 코드) 예상했지만..타임아웃 /** * @p..
[리트코드] 11. Container With Most Water - js (투포인터) 1. 문제 https://leetcode.com/problems/container-with-most-water/ Container With Most Water - LeetCode Can you solve this real interview question? Container With Most Water - You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that toget leetcode.com 2. 코드 /** * @param {number[]..
[리트코드] 72. Edit Distance - js (DP) 1. 문제 https://leetcode.com/problems/edit-distance/ Edit Distance - LeetCode Can you solve this real interview question? Edit Distance - Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations permitted on a word: * Insert a character * D leetcode.com 2. 코드 다양한 문제를 봤을 때, 두 개의 문자열의 각 자리를 비교하여 최소값을 리턴한다, ..
[리트코드] 1143. Longest Common Subsequence - js (DP) 1. 문제 https://leetcode.com/problems/longest-common-subsequence/ Longest Common Subsequence - LeetCode Can you solve this real interview question? Longest Common Subsequence - Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new string genera leetcode.com 2. 코드 이 문제는 DP(누적합)를 이용하여 ..

반응형