A Horizontal Bar Plot (swap x/y)
Tidewater Foods has product names long enough that upright bars end up with unreadable, overlapping labels underneath them, so the range chart is drawn on its side: names run down the left, bars run to the right. The buying team asks for one line of text with it, naming the product they should consider dropping.
Task: Print the product with the lowest sales figure.
Input
The first line holds one integer n, the number of products. Each of the next n lines holds a product name and its sales figure, separated by a single space. Product names contain no spaces and each product appears on exactly one line.
Output
One line holding a single product name, exactly as it was read. The ranking is on the sales figure, and the figure itself is not printed. If two products share the lowest figure, print whichever appeared first in the input.
Example:
Input:
3
Widget 500
Gadget 300
Gizmo 800
Output:
Gadget
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in