Loading...
Engaged Employer
Find the first two largest numbers in an array of integers.
Anonymous
int k = 2; int[] largestK = new int[k]; for(int i = 0; i min) largestK[minPos] = input[i]; } return largestK;
vector findLargest(vector input){ int max, max2; max = max2 = input[0]; for(int i = 0; i max){ max2 = max; max = input[i]; } else if(input[i] > max2) max2 = input[i]; } cout << max << endl << max2 << endl; }
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalized job recommendations and updates by starting your searches.