His second is trickier, but solvable. And, no, I've never seen that (particular) question before.
It could be the person studied up on all sorts of puzzles and famous algorithms online but hasn't really written or programmed anything.
Not all jobs require that much expertise. You could be doing some really simple programming work.
I think most interviewers ask these type of questions 1.) make themselves feel smart 2.) they get a kick out it
And your complaining that "not all jobs require that much expertise" is unfounded. I consider those to be novice questions, personally--and even if they weren't, you don't know what he's hiring for.
He's not being unreasonable. You, on the other hand, seem to be, and seem to be doing so in a rather defensive manner.
So do you have data to back up your claims that; answering those questions determine if your a good programmer.
Yes, there are tons of programming jobs out there, that don't require much of those skills. Not all jobs are that innovative.
Most of the development jobs I have seen require you to come up to speed with the code base fast. So it's that code reading comprehension that I think is most prevalent.
No interview or interview question can determine conclusively that you are a good programmer. But they reduce the likelihood that you're not, and comments like your strident and hysterical analogy drawn between these really very simple problems and "write a SSL library!" are doing little to change my mind.
There is an obvious recursive algorithm, but I'd be worried that if I gave that the interviewer would quibble about stack usage (although it is going to be linear in the number of items being permuted which should be OK most of the time).
Thinking a bit more, I can see that it should be possible to do an iterative algorithm that needs little or no state other than the last permutation generated and that given a sorted input string would generate the permutations in lexicographic order. The basic idea is that if you partition the string into two parts, AB, such that no permutation of B exists that is lexicographically after B, then the next permutation of AB is formed by replacing B with the lexicographically first permutation of B, and then exchanging the last character of A with the first character of the new B. (I think that will generate them all, in order--but I've not seriously analyzed it--I'm just riffing off the top of my head as I type here, like I'd be doing in an interview).
OK, now I'd worry about that step of replacing B with the lexicographically first permutation of B. That can be done by sorting B, but then the interviewer might complain about all that sorting. Aha! The lexicographically last permutation of B and the first permutation or reverses of each other, and reversal can be done in O(n). (And maybe it can be done even faster with some kind of doubly linked list to store strings as list of elements, where a string is represented by a pointer into the list, a length, and a direction flag...something to think about).
Anyway, the permutation question is fraught with potential pitfalls. I'd be smart enough, I hope, to do all the above musings out loud to give the interview a chance to jump in and tell me "It's OK...I just want to see if you can write code, so go ahead with the recursive solution".
That second problem is straightforward. It's just binary search. The rotated array doesn't change anything fundamental about it--it just slightly complicates the check to see which half the target element must lie in. There will always be at least one "normal" half--that is, a half where all the elements are sorted. You can recognize a normal half be the left endpoint being less than the right endpoint. You check for the target in a normal half the usual way. If the target is not in the normal half you check, it must be in the other half (or not in the array at all).
That said, C++'s standard library has a next_permutation function that returns the lexicographical next permutation of a pair of iterators (actually it does it in-place and returns a bool). If a candidate used that I'd allow it (as long as there was some discussion as to how it worked).
I've since stopped asking that question and now stick primarily with the split array question as I think it's less tricky. There's more than one way to solve it and most of the solutions build up on simpler solutions which makes for good discussion. I also don't ask for actual code for that problem unless I get the feeling the candidate will understand the problem better by expressing it in code.