본문 바로가기

Algorithm/코드 풀이

(183)
LeetCode: 81번 (Search in Rotated Sorted Array II) [JAVA] 문제 링크 https://leetcode.com/problems/search-in-rotated-sorted-array-ii/ Search in Rotated Sorted Array II - LeetCode Can you solve this real interview question? Search in Rotated Sorted Array II - There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). Before being passed to your function, nums is rotated at an unknown pivot leetcode.com 풀이 전체적인 풀이 과정..
LeetCode: 80번 (Remove Duplicates from Sorted Array II) [JAVA] 문제 링크 https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ Remove Duplicates from Sorted Array II - LeetCode Can you solve this real interview question? Remove Duplicates from Sorted Array II - Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place [https://en.wikipedia.org/wiki/In-place_algorithm] such that each unique elemen leetcode.com 풀이..
LeetCode: 78번 (Minimum Window Substring) [JAVA] 문제 링크 https://leetcode.com/problems/subsets/ Subsets - LeetCode Can you solve this real interview question? Subsets - Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1: Input: n leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 결과를 저장할 List
LeetCode: 77번 (Combinations) [JAVA] 문제 링크 https://leetcode.com/problems/combinations/ Combinations - LeetCode Can you solve this real interview question? Combinations - Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n]. You may return the answer in any order. Example 1: Input: n = 4, k = 2 Output: [[1,2],[1,3 leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 전체 숫자 풀을 나타내는 n, 그 중 조합에 포함될 숫자의 개..
LeetCode: 76번 (Minimum Window Substring) [JAVA] 문제 링크 https://leetcode.com/problems/minimum-window-substring/ Minimum Window Substring - LeetCode Can you solve this real interview question? Minimum Window Substring - Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If t leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 주어진 문자열..
LeetCode: 75번 (Sort Colors) [JAVA] 문제 링크 https://leetcode.com/problems/sort-colors/ Sort Colors - LeetCode Can you solve this real interview question? Sort Colors - Given an array nums with n objects colored red, white, or blue, sort them in-place [https://en.wikipedia.org/wiki/In-place_algorithm] so that objects of the same color are adjacent, with the colors leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 투 포인터 start, end를 각각 배열의 시작과 끝으로 설..
LeetCode: 74번 (Search a 2D Matrix) [JAVA] 문제 링크 https://leetcode.com/problems/search-a-2d-matrix/ Search a 2D Matrix - LeetCode Can you solve this real interview question? Search a 2D Matrix - You are given an m x n integer matrix matrix with the following two properties: * Each row is sorted in non-decreasing order. * The first integer of each row is greater than the last integer leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 주어진 숫자 target이 이차원 배..
LeetCode: 72번 (Edit Distance) [JAVA] 문제 링크 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 풀이 전체적인 풀이 과정은 다음과 같다. 주어진 word1의 길이, word2의 길이만큼의 2..