Leetcode with dani
前往频道在 Telegram
Join us and let's tackle leet code questions together: improve your problem-solving skills Preparing for coding interviews learning new algorithms and data structures connect with other coding enthusiasts
显示更多1 258
订阅者
无数据24 小时
+17 天
-730 天
帖子存档
1 258
Check out this AI browser perplexity browser
Discover a smarter way to browse! 🚀 Try the Perplexity Browser for lightning-fast answers, powerful AI tools, and next-level productivity. Perfect for work, study, and everyday browsing—share it with your friends and upgrade your internet experience today!
1 258
Repost from 「 Eyu core 」
Enjoy but don't get attached Give but dont expect Listen but dont judge Love but not depend and finally accept but dont settle
1 258
Don't ever save anything for a special occasion. Being alive is the special occasion.
— Mary Engelbreit
1 258
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
bu = [0] * n
for i in range(len(arr) - 2, -1, -1):
bu[i] = abs(arr[i] - arr[i + 1]) + bu[i + 1]
for j in range(i + 2, min(i + k + 1, len(arr))):
bu[i] = min(abs(arr[i] - arr[j]) + bu[j], bu[i])
现已上线!2025 年 Telegram 研究 — 年度关键洞察 
