1
Second Largest Element
Problem Solving
int arr[] = {12, 35, 1, 10, 34, 1};
int first = INT_MIN, second = INT_MIN;
for(int x : arr){
if(x > first){
second = first;
first = x;
} else if(x > second && x != first){
second = x;
}
}
cout << second; // 34