Company: Mckinsey data scientist IITB
Difficulty: medium
Predicting the S&P 500 Index An index such as the S&P 500 is not a mystery number: it is a fixed weighted combination of the prices of the stocks it tracks. If the market follows M stocks and the index weights are w[1], w[2], ..., w[M] , then at every minute index = w[1]*p[1] + w[2]*p[2] + ... + w[M]*p[M] where p[j] is the price of stock j at that minute. The weights never change, but you are not told what they are . You are given N past minutes for which both the M stock prices and the index value were recorded, and Q future minutes for which only the stock prices are known. For each future minute, report the index value. Sometimes the past is not informative enough. If two stocks only ever moved in lockstep, no amount of history can separate their weights, and a future minute in which they move apart has no single answer. Call a future minute determined when every weight vector that is consistent with all N recorded minutes gives it the same index value, and undetermined othe