본문 바로가기

Problems/Leetcode

(9)
Bitwise AND of Numbers Range (python) 문제 링크 : https://leetcode.com/problems/bitwise-and-of-numbers-range/ Bitwise AND of Numbers Range - LeetCode 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 문제 ) Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inc..
Longest Increasing Subsequence (python) 풀이 문제 링크 : https://leetcode.com/problems/longest-increasing-subsequence/ Longest Increasing Subsequence - LeetCode 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 문제 ) Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence tha..
Making A Large Island - python solution 문제 링크 : https://leetcode.com/problems/making-a-large-island/ Making A Large Island - LeetCode 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 문제 해설 n x n 크기의 행렬이 주어집니다. 단 한 번 행렬의 요소 0을 1로 바꿀 수 있습니다. 이 과정을 적용해서 얻을 수 있는 가장 큰 섬(island)의 크기를 반환하세요. 섬은 4방향으로 이어진 1로 이루어진 집합입니다. 제한 사항 n == grid.le..
3Sum Closest 문제 링크 : https://leetcode.com/problems/3sum-closest/ 3Sum Closest - LeetCode 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 문제 해설 : n개의 정수로 이루어진 배열 nums가 주어집니다. nums의 요소 중 3개의 합이 target에 가장 가까운 경우를 찾아 그 합을 반환하세요. 각각의 입력에 대해 정확히 하나의 해답만 있다고 가정해도 좋습니다. 제한 사항 1) 3
Convert Sorted Array to Binary Search Tree 문제 링크 : https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Convert Sorted Array to Binary Search Tree - LeetCode 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 문제 해설 : 모든 요소(elements)가 오름차순으로 정렬된 정수 배열 nums가 주어집니다. 이 배열을 높이가 균형 잡힌 이진 탐색 트리로 변환하세요. 높이가 균형 잡힌 이진 탐색 트리란..
Binary Tree Pruning 문제 링크 : https://leetcode.com/problems/binary-tree-pruning/ Binary Tree Pruning - LeetCode 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 문제 해설 : 이진 트리의 root가 주어집니다. 같은 tree에서 1을 포함하지 않는 subtree를 제거하여 반환하세요. 제한 사항 1) tree의 node의 개수는 [1, 200]을 만족합니다. 2) Node.val은 0 또는 1입니다. 두 가지 방법으로 문제를 해결했..
Number of Matching Subsequences 문제 링크 : https://leetcode.com/problems/number-of-matching-subsequences/ Number of Matching Subsequences - LeetCode 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 문제 해설 : 문자열 s와 문자열 배열 words가 주어집니다. 이 때 s의 subsequence를 만족하는 words[i]의 개수를 반환하는 함수를 작성하세요. (subsequence는 기존 문자열에서 순서를 바꾸지 않고 char..
Number of Subarrays with Bounded Maximum 문제 링크 : https://leetcode.com/problems/number-of-subarrays-with-bounded-maximum/ Number of Subarrays with Bounded Maximum - LeetCode 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 문제 해설 : 양수가 저장된 배열 nums와 두 양수 left, right가 주어집니다. ( left int: answer = 0 for start in range(len(nums)): maximum..
Matchsticks to Square 문제 링크 : https://leetcode.com/problems/matchsticks-to-square/ Matchsticks to Square - LeetCode 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 문제 해설 : 성냥의 길이가 저장된 배열이 주어집니다. 성냥은 부러뜨릴 수 없지만 이어붙일 수는 있습니다. 모든 성냥을 한 번씩 사용하여 정사각형을 만들 수 있으면 True를, 그럴 수 없으면 False를 반환하세요. 제한 사항 1) 1 bool: total = su..