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])
Leetcode with dani
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]…
the exact answer with c++ passed 😭
😁2
Don't ever save anything for a special occasion. Being alive is the special occasion.
— Mary Engelbreit
— Mary Engelbreit
❤10
Forwarded 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
❤7
Are you an African who dreams of building Google-level software engineering skills?
Applications are now open for A2SV G7 Education!
This is your moment to learn, grow, and prepare for the top tech companies you’ve always aspired to join.
At A2SV Education, you’ll join a vibrant community that challenges you to think bigger, code smarter, and create real impact across Africa 🌍.
⏱️ It only takes 7 minutes to apply. Take your shot at joining A2SV G7 Education today!
👉 Apply now: https://form.typeform.com/to/wOWdCFrZ
📣 Spread the word! Tag a friend, share this post, and help us reach more brilliant African minds ready to transform their future through A2SV.
Together, we empower Africa’s next generation of world-class engineers and tech entrepreneurs! 💪 💻
#A2SV #Education #Generation7 #TopTech #ApplicationsAreOpen #SoftwareEngineering #AfricaTech
Applications are now open for A2SV G7 Education!
This is your moment to learn, grow, and prepare for the top tech companies you’ve always aspired to join.
At A2SV Education, you’ll join a vibrant community that challenges you to think bigger, code smarter, and create real impact across Africa 🌍.
⏱️ It only takes 7 minutes to apply. Take your shot at joining A2SV G7 Education today!
👉 Apply now: https://form.typeform.com/to/wOWdCFrZ
📣 Spread the word! Tag a friend, share this post, and help us reach more brilliant African minds ready to transform their future through A2SV.
Together, we empower Africa’s next generation of world-class engineers and tech entrepreneurs! 💪 💻
#A2SV #Education #Generation7 #TopTech #ApplicationsAreOpen #SoftwareEngineering #AfricaTech
Forwarded from Yonathan
I just learned that every Android device has a tiny hardware chip that handles sensitive operations things like password protection, cryptographic keys, and authentication.
It can even verify your phone’s authenticity. It’s crazy how underused this feature is.
Please open Telegram to view this post
VIEW IN TELEGRAM
🆒2👍1
📝 Problem: Dividing Students
A teacher wants to divide a group of students into 3 subgroups for practice. Each student has a favorite programming language:
a students like Assembler
b students like Basic
c students like C++
The teacher knows that Assembler fans and C++ fans argue if they are in the same subgroup, so no subgroup should contain both Assembler and C++ fans.
The goal is to divide the students into 3 subgroups so that the largest subgroup is as small as possible.
Input
First line: t — number of test cases (1 ≤ t ≤ 5)
Each test case: three integers a b c (1 ≤ a, b, c ≤ 1000)
Output
For each test case: print the minimum possible size of the largest subgroup\
A teacher wants to divide a group of students into 3 subgroups for practice. Each student has a favorite programming language:
a students like Assembler
b students like Basic
c students like C++
The teacher knows that Assembler fans and C++ fans argue if they are in the same subgroup, so no subgroup should contain both Assembler and C++ fans.
The goal is to divide the students into 3 subgroups so that the largest subgroup is as small as possible.
Input
First line: t — number of test cases (1 ≤ t ≤ 5)
Each test case: three integers a b c (1 ≤ a, b, c ≤ 1000)
Output
For each test case: print the minimum possible size of the largest subgroup\
❤5