reduce running time to O(n). Accepted.

generate 10000 random numbers between -100 and 100 for testing in
python.
for i in range(1, 10000):
    random.randint(-100, 100)