Some interviewers just want to humiliate you and exercise their power over you.<p>Maybe.<p>Personally, I do use questions like this, and I'm looking for a combination of things.<p>Firstly, how much reading have you done, and how many of these things have you come across before? If you know them all, that tells me you have to hand an arsenal of techniques to bring to bear on a problem, and you care enough to have done considerable outside reading and preparation. That's a good sign.<p>Secondly, if there's a problem you've not met before, what do you do? Do you freeze? Do you go thoughtful? Do you ask questions to clarify? Do you look to step around the problem? Are you sufficiently confident in yourself to simply get to work, or are you worried that your inability will be seen as an excuse not to hire you?<p>Thirdly, as you start to work on it, what's your intuition like? What techniques do you bring to bear? Do you assume there's one, right, trick answer, or do you treat this as a challenge to be played with?<p>Finally, how do you react to contributions from others? Do you welcome working together and relish discovering stuff, or do you want to work alone, seeing how you get on?<p>All of these have positive and negative aspects when weighed against a given possible job. What I'm looking for is that balance between someone who brings new skills and knowledge to the team, and the ability to work with the team, and to have enough in common to be able to communicate effectively. Some people love puzzles, some hate them. Some are great at theoretical analyses, some aren't. Some people can devise or adapt algorithms, and some can't. A good team needs a balance, and asking these sorts of questions of people is part of finding out their strengths and weaknesses, to see how they'll fit in a team.<p>Do you want my advice?<p>Work on your abilities. Be professional in your personal development in whatever area you are interested in, as well as other related areas. Read widely, work on projects, work with people, and expose yourself to technologies outside your comfort zone. When faced with puzzles and problems like these, be yourself. Ask what's expected, and work with your interviewer in a professional manner - an interview should be a dialogue. At the end of the interview ask yourself - do I want to work with these people?<p>If they don't hire you for who you are and what you bring to the table then you would likely not be a good fit, and would likely not enjoy your work and/or the environment. If they offer you the position, you've learned a bit about what they are like to work with, so you are in a position to decide if you want the job.<p>But this is not an ideal world, so you will need to decide what compromises you're willing to make.