Answer Posted / fish
int a1(int[] a)
{
int max1 = -1;
int max2 = -1;
for (int i=0; i<a.length; i++)
{
if (a[i] > max1)
{
max2 = max1;
max1 = a[i];
}
else if (a[i] != max1 && a[i] > max2)
max2 = a[i];
}
return max2;
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the type of this pointer in c++?
Write a program which employs Recursion
How do I run c++?
What do manipulators do?
What are the unique features of C++.
Const char *p , char const *p What is the difference between the above two?
How do we balance an AVL Tree in C++?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.
What is a namespace in c++?
What is c++ redistributable?
What is pair in c++?
How would you use the functions randomize() and random()?
What is the best c++ book for beginners?
What is a lambda function c++?
What is static in c++?