Many programmer interviews these days use puzzles to try to assess the intelligence of the candidate. Interviewers may think that puzzles are a good way to see how candidates think outside of programming problems.

It's debatable whether puzzles are a good assessment of intelligence. But, you simply have to prepare for the questions that can be asked in an interview - whether or not you agree with the nature of the questions that are being asked.