Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missing
Here’s a summary of Dimitris Andreou’s link. Remember sum of i-th powers, where i=1,2,..,k. This reduces the problem to solving the system of equations a1 + a2 + … + ak = b1 a12 + a22 + … + ak2 = b2 … a1k + a2k + … + akk = bk Using Newton’s identities, … Read more