Let $k$ and $n$ be integers with $1\leq k<n$. Alice and Bob play a game with $k$ pegs in a line of $n$ holes. At the beginning of the game, the pegs occupy the $k$ leftmost holes. A legal move consists of moving a single peg to any vacant hole that is further to the right. The players alternate moves, with Alice playing first. The game ends when the pegs are in the $k$ rightmost holes, so whoever is next to play cannot move and therefore loses. For what values of $n$ and $k$ does Alice have a winning strategy?
1. **Claim**: Alice has a winning strategy if and only if \( n \) and \( k \) are not both even.

2. **Bob's Winning Strategy When \( n \) and \( k \) are Both Even**:
   - Let \( k = 2k_0 \) and \( n = 2n_0 \) for positive integers \( n_0 > k_0 \).
   - Define \( a_i \) as the pair of holes at positions \( 2i-1 \) and \( 2i \) for \( 1 \leq i \leq n_0 \).
   - Initially, the pairs \( a_1, a_2, \ldots, a_{k_0} \) are occupied, and the remaining pairs are empty.

3. **Inductive Proof**:
   - **Base Case**: Initially, \( k_0 \) pairs \( a_1, a_2, \ldots, a_{k_0} \) are occupied.
     - Alice moves a peg from \( a_i \) to \( a_j \) where \( 1 \leq i \leq k_0 \) and \( k_0 < j \leq n_0 \).
     - Bob then moves the remaining peg from \( a_i \) to the remaining empty hole in \( a_j \).
     - This results in \( \{a_1, a_2, \ldots, a_{k_0}\} \cup \{a_j\} \setminus \{a_i\} \) being occupied, maintaining \( k_0 \) occupied pairs.
   - **Inductive Step**: Assume \( k_0 \) pairs are occupied before Alice's move.
     - Alice moves a peg from \( a_i \) to \( a_j \) where \( 1 \leq i \leq k_0 \) and \( k_0 < j \leq n_0 \).
     - Bob then moves the remaining peg from \( a_i \) to the remaining empty hole in \( a_j \).
     - This results in \( k_0 \) pairs being occupied, maintaining the inductive hypothesis.

4. **Conclusion for Bob's Strategy**:
   - The game ends when \( a_{n_0-k_0+1}, a_{n_0-k_0+2}, \ldots, a_{n_0} \) are occupied.
   - This can only occur after one of Bob's moves, meaning Bob makes the last move and wins.

5. **Alice's Winning Strategy When \( n \) or \( k \) is Odd**:
   - **Case 1**: \( k \) is odd and \( n \) is even.
     - Alice moves the peg from the first hole to the last hole.
     - The resulting position is equivalent to a game with \( k-1 \) pegs and \( n-2 \) holes.
     - Since \( k-1 \) and \( n-2 \) are both even, and Bob makes the first move, Alice wins.
   - **Case 2**: \( k \) is even and \( n \) is odd.
     - Alice moves the peg from the first hole to the \( k+1 \)-th hole.
     - The resulting position is equivalent to a game with \( k \) pegs and \( n-1 \) holes.
     - Since \( k \) and \( n-1 \) are both even, and Bob makes the first move, Alice wins.
   - **Case 3**: \( k \) and \( n \) are both odd.
     - Alice moves the peg from the \( k \)-th hole to the last hole.
     - The resulting position is equivalent to a game with \( k-1 \) pegs and \( n-1 \) holes.
     - Since \( k-1 \) and \( n-1 \) are both even, and Bob makes the first move, Alice wins.

The final answer is Alice has a winning strategy if and only if \( \boxed{ n } \) and \( k \) are not both even.