mini-max sum [HackerRank] | Python | Algorithm | Interview

preview_player
Показать описание
This video is about min-max sum problem from HackerRank.
Problem statement:
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.
For example,arr=1,3,5,7,9 . Our minimum sum is1+3+5+7=16 and our maximum sum is 3+5+7+9=24
we will print o/p as 16 24

For 1 : 1 Tutoring
WhatsApp contact : 7278222619

Follow us on:
Whatsapp:
Telegram:

For Python homework help visit our sponsor site

Facebook:

Linkedin:

Instagram:

#HackerRank #Algorithm #Interview
Рекомендации по теме
Комментарии
Автор

legends be like these:
def miniMaxSum(arr):
arr.sort()
minimum = arr[0] + arr[1] + arr[2] + arr[3]
maximum = arr[1] + arr[2] + arr[3] + arr[4]
print(minimum, maximum)
just for fun 😅

_Doffy-tbqv
Автор

Please make video on ema's supercomputer hacker rank in python

deepgupta
Автор

cat = []
for i in range(0, len(arr)):
cat.append(sum(arr) - int(arr[i]))
print(f'{min(cat)} {max(cat)}')
sir my soloution you are very nice having great problem solving skills but still teaching us for free salute you to sir i wish i will also become like you

infinitygaming
Автор

Good but i have a problem bro i wrote different way but hackerrank console return me (10, 14) why ? i wrote your code and again return me like that

soulfly