본문 바로가기
반응형

분류 전체보기128

[DSA][Binary Search] 02. Search a 2D Matrix LeetCode 74 02. Search a 2D MatrixYou 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 of the previous row.Given an integer target, return true if target is in matrix or false otherwise.You must write a solution in O(log(m * n)) time complexity. [질문하기]- 행렬의 크기 .. 2025. 6. 16.
[DSA][Binary Search] 01. Binary Search LeetCode 704 01. Binary SearchGiven an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums.If target exists, then return its index. Otherwise, return -1.You must write an algorithm with O(log n) runtime complexity. [질문하기]- 배열의 길이의 제한이 어떻게 되나요? (l+r이 오버플로우를 일으킬 수 있는지)- 배열에 중복된 값이 있을 수 있나요? NO [아이디어]- Binary Search를 사용하자. [.. 2025. 6. 15.
[DSA][Sliding Window] 05. Sliding Window Maximum LeetCode 239 05. Sliding Window MaximumYou are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right.You can only see the k numbers in the window. Each time the sliding window moves right by one position.Return the max sliding window. [질문하기]- num 배열의 길이가 k 보다 작을 수 있나요?- nums에 음수나 중복된 값이 포함될 수 있나요? [아이디어]- Sliding .. 2025. 6. 14.
[DSA][Sliding Window] 04. Minimum Window Substring LeetCode 76 04. Minimum Window SubstringGiven 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 there is no such substring, return the empty string "".The testcases will be generated such that the answer is unique. [질문하기]- 문자 비교는 대소문자를 구분하나요? YES- 항상 valid 한 정답이 있나요? N.. 2025. 6. 11.