본문 바로가기

전체 글

(209)
[LeetCode] Minimum Size Subarray Sum 풀어보기 https://leetcode.com/problems/longest-repeating-character-replacement/submissions/2171812721/ Longest Repeating Character Replacement - LeetCodeCan you solve this real interview question? Longest Repeating Character Replacement - You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this opera..
[LeetCode] Minimum Size Subarray Sum 풀어보기 https://leetcode.com/problems/minimum-size-subarray-sum/description/ Minimum Size Subarray Sum - LeetCodeCan you solve this real interview question? Minimum Size Subarray Sum - Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no such subarrleetcode.com비교적 간단한 투포인터? 슬라이딩윈도우? 문제..
[LeetCode] Trapping Rain Water 풀어보기 https://leetcode.com/problems/trapping-rain-water/ Trapping Rain Water - LeetCodeCan you solve this real interview question? Trapping Rain Water - Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: [https://assets.leetcode.com/uplleetcode.com이전에 백준에 빗물트래핑? 이라는 비슷한 문제가 있었던거 같은데 이 문제에서 따왔나 싶네요..
Leetcode[two pointer] 3Sum 풀어보기 https://leetcode.com/problems/3sum/submissions/2167042503/ 3Sum - LeetCodeCan you solve this real interview question? 3Sum - Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duleetcode.com문제는 배열의 원소 a, b, c의 합이 0인 값을 찾는 것입니다. 다만 배열 원소의 조합이 중복되어..
Leetcode[Hash] Longest Consecutive Sequence 풀어보기 https://leetcode.com/problems/longest-consecutive-sequence/submissions/2166160484/ Longest Consecutive Sequence - LeetCodeCan you solve this real interview question? Longest Consecutive Sequence - Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Example 1: Input:leetcode.com 연속된 수열을 찾는 ..
[Leetcode][PrefixSum] Merge Intervals 풀어보기 https://leetcode.com/problems/product-of-array-except-self/submissions/2163925484/ 오늘의 문제는 누적합을 사용하는 문제입니다. 실제로 따지고 보면 합은 아니지만 형태는 그런 방식입니다.각 answer[i]에는 본인 nums[i]를 제외한 나머지 모든 값을 곱한 결과를 저장해야합니다. 문제의 조건은 O(n)의 복잡도를 사용하면서 division operation을 사용하지 않는것입니다.만약 division을 사용할 수 있다면, 모두 곱하고 필요한 값만 나누면 되기 때문에 매우 쉽게 해결할 수 있는데 이 경우를 회피하기 위함인것으로 보입니다. 본인 외의 모든 값을 곱하는 것을 반복한다면 쉽게 결과를 얻을 수 있겠지만 이 경우는 O(n^2..
[Leetcode][Greedy] Merge Intervals 풀어보기 https://leetcode.com/problems/merge-intervals/submissions/ Merge Intervals - LeetCodeCan you solve this real interview question? Merge Intervals - Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the inputleetcode.com간단한 그리디 문제입니다. 일단은 주어지는 2차원 배열이 정렬된 상태는 아니이기에 정..
[LeetCode][Dijkstra] NetworkDelayTime 풀어보기 https://leetcode.com/problems/network-delay-time/submissions/?utm_source=chatgpt.com Network Delay Time - LeetCodeCan you solve this real interview question? Network Delay Time - You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (ui, vi, wi), where ui is the source node, vi is the tarleetcode.com 이번 문제는 다익스트라 알고..