New update is available. Click here to update.

Problem title
Difficulty
Avg time to solve

Maximum Subarray Sum
Hard
35 mins
Flower Shop
Easy
--
Swap Two Numbers
Easy
10 mins
Find Unique
Easy
--
Beautiful String
Easy
18 mins
Duplicate In Array
Easy
15 mins
Yogesh And Primes
Moderate
20 mins
First Missing Positive
Moderate
18 mins
First and Last Position of an Element In Sorted Array
Easy
15 mins

Sum Of Max And Min

Contributed by
Priyaraj
Easy
Avg time to solve 10 mins
Success Rate 90 %
Share
315 upvotes

Problem Statement

You are given an array “ARR” of size N. Your task is to find out the sum of maximum and minimum elements in the array.

Follow Up:
Can you do the above task in a minimum number of comparisons?
Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1:
2
7
1 2 4 5 6 6 6 
6
-1 -4 5 8 9 3
Sample Output 1:
7
5
Explanation For Sample Input 1:
For the first test case, the maximum element in the array is 6 and the minimum element in the array is 1.

For the second test case, the maximum element in the array is 9 and the minimum element in the array is -4.
Sample Input 2:
2
5
3 3 3 3 3 
1
-1
Sample Output 2:
6
-2
Reset Code
Full screen
copy-code
Console