Skip to content

3rd largest no in unsorted array using JAVA #841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3rd largest no in unsorted array using JAVA
  • Loading branch information
binaryshrey committed Oct 1, 2019
commit a55b7cc849930f4e53d58e38898e8becf504d711
21 changes: 21 additions & 0 deletions SOLUTIONS/3rd-largest-no-in-unsorted-array.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[n];
for(int i=0;i<n;i++)
arr[i] = sc.nextInt();
Arrays.sort(arr);
System.out.println(arr[2]);
}
}