Oracle Interview Question

Given a given stock for a specific day. One number per second stored in an array. Write an algorithm to find the maximum profit you could make in that day. Generalize to several months of data with ticks per milliseconds.

Interview Answer

Anonymous

Nov 14, 2015

Possible in O(N) by keeping track of min_val and max_profit. For generalization, same thing in MapReduce.

1