Sign in to run tests against edge cases and save your code automatically.
Problem Description
Medium
Second Largest Value
PRO1D & 2D Arrays
1D & 2D Arrays
Maximum Tracking
Traversal
Write a program that inputs 6 **different** integers into an array and outputs the second largest value.
Do not sort the array: find the answer by keeping track of the largest and second largest values as you traverse it once.
For example, the values 4, 9, 2, 7, 5, 1 have a largest value of 9 and a second largest value of 7.
Example Input
4
9
2
7
5
1
Example Output
7
Success Rate:
0% (0 passed / 0 attempted)
Code
Draft auto-saved
Test Results
Click "Test Code" to evaluate your code against the tests.