Problem of the day

Login

New update is available. Click here to update.

All Problems

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

Problem

Submissions

```
Can you do the above task in a minimum number of comparisons?
```

Detailed explanation ( Input/output format, Notes, Constraints, Images )

```
The first line of input contains a single integer T, representing the number of test cases.
Then the T test cases follow.
The first line of each test case contains a single integer N representing the size of the array 'ARR'.
The second line of each test case contains N space separated integers representing the elements of the array “arr”.
```

```
For each test case, print the sum of the maximum and minimum element of the array 'ARR'.
```

```
You do not need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10
1 <= N <= 10^5
-10^9 <= ARR[i] <= 10^9
Time limit: 1 second
```

```
2
7
1 2 4 5 6 6 6
6
-1 -4 5 8 9 3
```

```
7
5
```

```
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.
```

```
2
5
3 3 3 3 3
1
-1
```

```
6
-2
```

Java (SE 1.8)

Console

Change Theme

Full Screen Mode

Solution submission not allowed

Reset Code