Pergunta de entrevista da empresa Oracle

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.

Resposta da entrevista

Sigiloso

14 de nov. de 2015

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

1