Tricky Google interview question
Dijkstra derives an eloquent solution in “A Discipline of Programming”. He attributes the problem to Hamming. Here is my implementation of Dijkstra’s solution. int main() { const int n = 20; // Generate the first n numbers std::vector<int> v(n); v[0] = 1; int i2 = 0; // Index for 2 int i5 = 0; // … Read more