반응형 분류 전체보기128 [DSA][Sliding Window] 03. Permutation in String LeetCode 567 03. Permutation in StringGiven two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.In other words, return true if one of s1's permutations is the substring of s2. [질문하기]- 문자열은 26개의 소문자 Character로만 이루어지나요? YES [아이디어]- Sliding window 기법과 26 크기의 배열을 사용하여 len(s1)만큼 check 하고 window를 한 칸씩 옮겨나가자. [풀이 1] Sliding Windowclass Solution: def checkInc.. 2025. 6. 10. [DSA][Sliding Window] 02. Longest Repeating Character Replacement LeetCode 424 02. Longest Repeating Character ReplacementYou 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 operation at most k times.Return the length of the longest substring containing the same letter you can get after performing the above operations. [질문하기]- 문자열은 26개의 대문자 Character로만.. 2025. 6. 9. [DSA][Sliding Window] 01. Longest Substring Without Repeating Characters LeetCode 3 01. Longest Substring Without Repeating Given a string s, find the length of the longest substring without duplicate characters. [질문하기]- 대소문자를 구분하나요?- 문자열에 공백이나 특수 문자가 있을 때 어떻게 처리해야 하나요? 공백들도 중복된 문자로 간주하나요? [아이디어]- 문자, 인덱스를 기록해 놓고 중복된 문자가 들어오면 길이를 세는 시작점을 (인덱스 + 1)로 옮긴다. [풀이 1] Sliding Windowclass Solution: def lengthOfLongestSubstring(self, s: str) -> int: mp = {} .. 2025. 6. 8. [DSA][Two Pointers] 06. Best Time to Buy and Sell Stock LeetCode 121 06. Best Time to Buy and Sell StockYou are given an array prices where prices[i] is the price of a given stock on the ith day.You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0. [질문하기]- 주식을 .. 2025. 6. 7. 이전 1 ··· 16 17 18 19 20 21 22 ··· 32 다음