Sasha is playing a game. She has $43$ cupboards lined up in a row, and each cupboard is initially open. On her first move, she picks and closes one cupboard. Then, on her second move, she picks two adjacent cupboards independent of the first move and closes the cupboard if it is open and opens the cupboard if it is closed. On her third move, she picks three adjacent cupboards and does the same thing. She continues doing this until she has made $43$ moves. Is it possible for all of the cupboards to be closed after she finishes her $43$ moves?
I first noted that all of the cupboards after the $42$nd move have to be open, but I wasn't sure where to go from here.
If there are $n$ cupboards then let the number $s = s_1 s_2 s_3\dots s_n$ represent which cupboards are open and which are closed. If $s_i = 1$ then cupboard $i$ is open and if $s_i = 0$ then it is closed. For example $s=10010$ means that there is $5$ cupboards and cupboard $1$ and $5$ are open. A move $m = m_1m_2\dots m_n$ specifies which cupboards are being changed. The term $m_j = 1$ means cupboard $j$ is changing (if the cupboard $j$ was open $m_j=1$ means it is being closed and if $j$ was closed $m_j=1$ means it is being open) and $m_j=0$ means the cupboard is being left alone. Let $m(i)$ represent move $i$, i.e., $m(3)$ means that this is move three where $3$ cupboards are changed. Your goal is to find a sequence of moves $m(1), m(2), \dots, m(n)$ to change $s=111\dots 1$ to $000\dots 0$.
Here are some hints to help you out:
When you perform a move, is it the same as $s\oplus m$ where $\oplus$ is the xor operation?
If you make move $m$ first and then move $t$ second is it different than move $t$ first and move $m$ second, i.e., Does $(s\oplus m)\oplus t$ equal $(s\oplus t)\oplus m$?
Is there a pairing strategy you can make? For $n=5$ notice that if $m(1) = 10000$ and $m(4)=01111$ then $m(1)\oplus m(4) = 11111$. Similarly, $m(2)=11000$ and $m(3)=00111$ then $m(2)\oplus m(3) = 11111$. Can you use this to your advantage? Can you use this to solve the problem for any $n$?
If $s$ has $p$ number of $1$'s in it and $m$ has $q$ number of $1$'s in it, how does the number of $1$'s change on $s\oplus m$, i.e., odd or even number of $1$'s?
Hopefully, this is enough of a hint for you to figure out the rest.