Fidelity Investments Interview Question

Based on some sorting and ordering.