all InfoSec news
Min-Max-Sum hacker rank solution
March 28, 2022, 5:03 a.m. | Anin Arafath
DEV Community dev.to
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.
Example :-
arr = [1,3,7,5,9]
minimum sum is and the maximum sum is 1+3+5+7 = 16 and the maximum sum is 3+7+5+9 =24
The function prints
16 14
code :-
void miniMaxSum(vector<int> arr) {
long long int sum =0;int maxVal=arr[0],minVal=arr[0];
for(int …
More from dev.to / DEV Community
Jobs in InfoSec / Cybersecurity
SOC 2 Manager, Audit and Certification
@ Deloitte | US and CA Multiple Locations
Information Security Engineers
@ D. E. Shaw Research | New York City
L2-Network Security Administrator
@ Kyndryl | KIN51515 Mumbai (KIN51515) We Work
Head of Cybersecurity Advisory and Architecture
@ CMA CGM | Marseille, FR
Systems Engineers/Cyber Security Engineers/Information Systems Security Engineer
@ KDA Consulting Inc | Herndon, Virginia, United States
R&D DevSecOps Staff Software Development Engineer 1
@ Sopra Steria | Noida, Uttar Pradesh, India