139. Largest Value in the List
Foundation1000 ms256 MBSolved by 0%
Build the list and print its largest value.
Print Empty for an empty list.
Constraints - `0 ≤ n ≤ 100000` - `-1000000 ≤ value ≤ 1000000`
Input
The first line contains an integer n, the number of nodes.
The second line contains n space-separated integers — the node values from head to tail.
The starter code builds the list for you; work on the nodes, not the array.
Output
Print one integer — the largest node value, or Empty for an empty list.
Input5
3 9 2 9 4
Output9
Notehas the maximum appearing twice
Input3
-8 -2 -15
Output-2
Noteis entirely negative, so a running best starting at zero is wrong
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution