Problem title
Difficulty
Avg time to solve

Search an Element in an Array
Easy
15 mins
Binary Numbers
Easy
10 mins
The N - Queens Puzzle
Moderate
--
Hotel Floors
Easy
10 mins
Find Missing Number In String
Moderate
15 mins
Potter and Profit
Easy
15 mins
Two Sum IV - Input is a BST
Moderate
30 mins
Course Schedule II
Hard
50 mins
Remainder When Divided By 11
Easy
15 mins
Count Distinct Subarrays With At Most K Odd Elements
Moderate
10 mins 9

# Fourth Largest Element in the Array

Difficulty: EASY
Avg. time to solve
20 min

Problem Statement

#### If there is no such number present in the array, then print the minimum value of an integer which is -2147483648.

``````Try solving this problem in O(N) time complexity.
``````
##### Input format:
``````The first line of input contains the integer 'N' representing the size of the array.

The second line of input contains N space-separated integers representing the array elements.
``````
##### Output Format:
``````The only output line contains the fourth-largest element if present, otherwise print -2147483648
``````
##### Note:
``````You are not required to explicitly print the output, it has already been taken care of. Just implement the function.
``````
##### Constraints :
``````1 <= N < 10^6
-10^6 <= element <= 10^6

Time Limit: 1 sec
``````
##### Sample Input 1:
``````5
3 5 1 3 1
``````
##### Sample Output 1:
``````1
``````
##### Explanation Of Sample Input 1:
``````5 is the largest element, 3 is the second-largest element, again we have a 3 so it's the third largest and 1 is the fourth-largest, hence the answer 1.
``````
##### Sample Input 2:
``````4
9 9 9 9
``````
##### Sample Output 2:
``````9
``````   Console