employer cover photo
employer logo
employer logo

Raja Software Labs

Is this your company?

Raja Software Labs Interview Question

How to find the second highest number in an integer array, without sorting the array?

Interview Answers

Anonymous

Apr 15, 2019

public static void secondLargest(){ int arr[] = {50,80,70,2,35,10,3,30,28,100}; int first = 0, second = 0; for(int i=0;ifirst){ second = first; first = arr[i]; } else if(arr[i]>second) second = arr[i]; } System.out.print("Sec Largest : "+second); }

3

Anonymous

Jun 27, 2018

can you plz share the whole process and all questions?

4