일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 리트코드
- GenAI
- GenerativeAI
- gcp
- nlp
- codeup
- 파이썬기초100제
- 코드업
- Microsoft
- Blazor
- 머신러닝
- 클라우드
- two-pointer
- 구글퀵랩
- Azure
- C#
- 빅데이터
- 파이썬기초
- 코드업파이썬
- LeetCode
- Python3
- 데이터사이언스
- 생성형AI
- 투포인터
- 알고리즘
- 파이썬알고리즘
- 자연어처리
- Python
- 릿코드
- 파이썬
Archives
- Today
- Total
목록twopointers (2)
Tech for good

class Solution: def isSubsequence(self, s: str, t: str) -> bool: i, j = 0, 0 # Pointers for s and t while i i += 1 -> s의 인덱스를 증가j += 1 -> s와 상관없이 (즉, 매치됨과 상관없이) t의 인덱스를 하나씩 증가 Example 2의 경우, x가 t에 없으므로 i False시간 복잡도 및 공간 복잡도시간 복잡도: O(n) (t의 길이만큼 한 번 순회)공간 복잡도: O(1) (추가적인 공간 사용 없음)
IT/Computer Science
2025. 2. 18. 23:29

class Solution: def rotate(self, nums: List[int], k: int) -> None: n = len(nums) k = k % n # In case k is larger than n # Step 1: Reverse the entire array nums.reverse() # Step 2: Reverse the first k elements nums[:k] = reversed(nums[:k]) # Step 3: Reverse the remaining n-k elements nums[k:] = reversed(nums[k:]) ..
IT/Computer Science
2025. 2. 18. 00:41