Embercode
✕
Functions, arrays and objectsCoding problems

Functions, arrays and objects: coding problems

Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.

0 of 8 solved

  • A school ranks quiz scores. The top score gets gold, and the **second largest distinct** score gets silver. Two students with the same score share one rank, so 9 9 7 has gold 9 and silver 7.

    Read the scores and print the second largest distinct value. If fewer than two distinct values exist, print none.

    Constraints: 1 <= n <= 2000, each score is between -1000 and 1000.

    Input. First line n. Second line n integers separated by spaces.

    Output. One integer, or the word none.

    Example 1 input

    5
    3 9 2 9 7
    

    Output

    7