일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- stratascratch
- 파이썬
- 리트코드
- 파이썬기초100제
- sql코테
- GenAI
- heap
- slidingwindow
- 자연어처리
- 니트코드
- 릿코드
- 파이썬알고리즘
- dfs
- 구글퀵랩
- LeetCode
- 생성형AI
- 알고리즘
- codeup
- 코드업
- SQL
- Microsoft
- 투포인터
- Python
- 슬라이딩윈도우
- medium
- gcp
- Python3
- two-pointer
- GenerativeAI
- nlp
Archives
- Today
- Total
목록heapq.nlargest() (1)
Tech for good

You can solve this problem by:Finding the k largest elements based on value (to maximize the sum).Preserving their original order in the array (since it's a subsequence).class Solution: def maxSubsequence(self, nums: List[int], k: int) -> List[int]: # Step 1: Pair each element with its original index indexed_nums = list(enumerate(nums)) # Step 2: Select the k larg..
IT/Computer Science
2025. 4. 4. 22:38