Hello Programmers/Coders, Today we are going to share solutions of Programming problems of HackerRank, Algorithm Solutions of Problem Solving Section in Java. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.
In this post, you will find the solution for Mini-Max Sum in Java-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.
Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.
Introduction To Algorithm
The word Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed upon in order to get the expected results.
Advantages of Algorithms:
- It is easy to understand.
- Algorithm is a step-wise representation of a solution to a given problem.
- In Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the programmer to convert it into an actual program.
Link for the Problem – Mini-Max Sum – Hacker Rank Solution
Mini-Max Sum – Hacker Rank Solution
Problem:
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
![Mini-Max Sum in Algorithm | HackerRank Programming Solutions | HackerRank Problem Solving Solutions in Java [💯Correct] 2 image 44](https://technorj.com/wp-content/uploads/2021/12/image-44.png)
16 24
Function Description
Complete the miniMaxSum function in the editor below.
miniMaxSum has the following parameter(s):
- arr: an array of integers
Print two space-separated integers on one line: the minimum sum and the maximum sum of of elements.
Input Format
A single line of five space-separated integers.
Constraints
![Mini-Max Sum in Algorithm | HackerRank Programming Solutions | HackerRank Problem Solving Solutions in Java [💯Correct] 3 image 46](https://technorj.com/wp-content/uploads/2021/12/image-46.png)
Output Format
Print two space-separated long integers denoting the respective minimum and maximum values that can be calculated by summing exactly four of the five integers. (The output can be greater than a 32 bit integer.)
Sample Input
1 2 3 4 5
Sample Output
10 14
Explanation
![Mini-Max Sum in Algorithm | HackerRank Programming Solutions | HackerRank Problem Solving Solutions in Java [💯Correct] 4 image 45](https://technorj.com/wp-content/uploads/2021/12/image-45.png)
Mini-Max Sum – Hacker Rank Solution
public class MiniMaxSum { static void miniMaxSum(int[] arr) { long min = 0, max = 0, sum = 0; min = arr[0]; max = min; sum = min; for (int i = 1; i < arr.length; i++) { sum += arr[i]; if (arr[i] < min) { min = arr[i]; } if (arr[i] > max) { max = arr[i]; } } System.out.print((sum - max) + " " + (sum - min)); } }
tadalafil 5mg price generic cialis cost buy erectile dysfunction drugs over the counter
duricef pills order duricef 250mg online finasteride over the counter
diflucan over the counter order diflucan 100mg without prescription buy cipro 500mg
mebendazole cheap buy cheap tadalis tadalafil sale
metronidazole over the counter order septra online cheap order cephalexin 125mg sale
avanafil 100mg tablet order avana 200mg oral cambia
purchase cleocin pill purchase cleocin sale buy ed pills us
order indocin 75mg for sale order lamisil 250mg generic suprax 200mg cheap
nolvadex pills budesonide for sale online order cefuroxime 500mg pill
trimox without prescription buy generic arimidex for sale cheap clarithromycin 500mg
brand catapres 0.1 mg order antivert 25 mg sale spiriva order
careprost over the counter buy methocarbamol generic buy desyrel pills
buy minocycline capsules buy minocycline 100mg for sale buy pioglitazone without a prescription
suhagra 100mg oral sildenafil 100mg sale sildenafil for women
leflunomide 10mg uk sildenafil 100mg uk oral azulfidine 500mg
order tadalafil generic tadalafil without prescription order cialis 10mg online
isotretinoin online buy purchase zithromax buy azithromycin 500mg online
ivermectin over the counter canada deltasone for sale online deltasone 10mg without prescription
oral azithromycin 500mg order generic omnacortil 10mg buy gabapentin 100mg sale
cheap furosemide doxycycline for sale strongest over the counter antihistamine
levitra 20mg oral zanaflex cheap buy plaquenil 400mg pill
order vardenafil plaquenil 400mg sale hydroxychloroquine oral
temovate medication buspirone 5mg tablet cordarone 200mg ca
benicar us order divalproex online cheap buy divalproex for sale
order clobetasol cost buspirone order amiodarone 200mg pills