Leetcode with dani – Telegram
Leetcode with dani
1.31K subscribers
196 photos
14 videos
56 files
240 links
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
Download Telegram
😁7😭5
😁
😁13👎2
Forwarded from Tech Nerd (Tech Nerd)
Gammadaa Goolloo 🇪🇹
Call for Life-Saving Support
My close friend shared the story of his Dorm mate Seenicha, a young student/writer from Bule Hora who’s been fighting a severe illness for years. He’s been bedridden for over 27 months, and doctors say without urgent treatment in Addis, he could lose all control of his body.

The treatment costs are way beyond what he or his family can afford (over 1M birr). He’s literally at a life or death point right now. If you can support, please send whatever you’re able 🙏 Every bit counts.

Bank info: 1000718160522
PhoneNo : +251913612984 ( his phone number )

And even if you can’t donate, just sharing this could reach someone who can. Let’s come together and save this young man’s life.

@selfmadecoder.
🙏41
8
Forwarded from 「 Eyu core 」
🔥8
Woow
21
መልካም የመስቀል በዓል ይሁንላችሁ
10👍1💋1
new feature
😭
😁8😭4
i wrote a code and submitted it but when i looked at it, it always returned True then i wrote this and submitted it and it worked, i didnt expect this answer for DP question😂😂
🤣9😁2
Amazing 🥳
15🎉3
6
this question freaks me out 🥵 i coundnt pass the time constraint
Leetcode with dani
this question freaks me out 🥵 i coundnt pass the time constraint
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])

print(bu[0])