Matthew has a deck of 300 cards numbered 1 to 300. He takes cards out of the deck one at a time, and places the selected cards in a row, with each new card added at the right end of the row. Matthew must arrange that, at all times, the mean of the numbers on the cards in the row is an integer. If, at some point, there is no card remaining in the deck which allows Matthew to continue, then he stops. When Matthew has stopped, what is the smallest possible number of cards that he could have placed in the row? Give an example of such a row.
I have successfully interpreted the problem. But I am not able to proceed.
$$k+1|x_1+x_2+...+x_k+\theta$$ where $\theta$ is the new card no.
Now we need to find the minimum value of $k$. But how?
When $k = 16$, and we are going to place the 17-th card, with the first 16 being $a_1, \cdots, a_{16}$. Then $a_{17}$ has to satisfy $a_{17} \equiv -\sum_{i=1}^{16}a_i \pmod{17}$. But there are at least $\lfloor \frac{300}{17}\rfloor = 17$ numbers in the range 1 to 300, in each congruent class. So you can always get up to 17 cards.
When $k = 17$, and we are going to place the 18-th card, things are different. Since $\lceil\frac{300}{18}\rceil = 17$, each congruence class modulo 18 has at most 17 cards. If all the 16 or 17 cards in that congruence class are already chosen, then you have nothing to pick.
It now remains to find a sequence of length 17 satisfying your criteria and making the 18-th card impossible. The 17 numbers has to form a complete congruence class modulo 18. And you will actually see that the sum of the 17 numbers will be a multiple of 9. This means that congruence class has to be $\equiv 0$ or $9 \pmod{18}$. There are only 16 numbers in 1 to 300 which is $\equiv 0 \pmod{18}$, and there are 17 numbers which is $\equiv 9 \pmod{18}$.
So what you have to do is to try to arrange the order of the 17 numbers $9, 27, 45, \cdots, 297$. What can you do?