Live data from Hacker News

Typing the technical interview

aphyr.com

21–30 of 86 posts

Re: Typing the technical interview

#22

It's odd. There are people who complain on Hacker News about interviewers who ask about algorithmic complexity: "when are we ever going to need this?" This is about wasting an interview demonstrating a semi-obscure technique that's fascinating but mostly useless, and it gets widely praised. Seems like it's just that fantasizing about turning the tables on an interviewer is fun, never mind whether it makes sense or no…

Type level programming is a powerful feature. This is of course a humorous show off which still neatly demonstrates it.

Re: Typing the technical interview

#23
post #13

Earlier quoted context omitted.

People like Criss who ask this question in interviews are looking for a brute force solution with recursive backtracking.

Is that not what's happening here? Except GHC has the recursive backtracking built in? The code looks a lot like the equivalent Prolog implementation.

I think you're supposed to show that you know how to do that yourself, instead of just using an existing implementation.

Re: Typing the technical interview

#24
post #13
post #12

For the N queens on an NxN chess board, wouldn't you put them in a fibonaci spiral? Of course I can draw the board and explain it, but I have no idea how show that fibonaci formula modified for a chess board. Do you think that would be enough?

People like Criss who ask this question in interviews are looking for a brute force solution with recursive backtracking.

Though I don't think I would use backtracking for an actual haskell solution. Probably something like:

    import Data.List (permutations)

    solve :: Int -> [[Int]]
    solve i = filter (valid . zip [1..]) (permutations [1..i])

    valid :: [(Int, Int)] -> Bool
    valid [] = True
    valid (x:xs) = singleValid x xs && valid xs
      where
        singleValid x xs = all (pairwiseValid x) xs
        pairwiseValid (x1, y1) (x2, y2) = abs (x1-x2) /= abs (y1-y2)

Re: Typing the technical interview

#25

Sad to say, this is exactly the sort of magic that, as the conclusion suggests, gets people not hired. Even on this very enlightened forum people argue in favour of less knowledgeable candidates (even with all else being equal).

I think you'd need the right kind of position for someone like this. Presumably, Criss wasn't trying to hire for a council of Haskell type-warlocks. Toss this person into a typical dev role, and you've got a recipe for boredom on their side and confusion on the part of the rest of the team.

Re: Typing the technical interview

#26
post #13
post #12

For the N queens on an NxN chess board, wouldn't you put them in a fibonaci spiral? Of course I can draw the board and explain it, but I have no idea how show that fibonaci formula modified for a chess board. Do you think that would be enough?

People like Criss who ask this question in interviews are looking for a brute force solution with recursive backtracking.

I'm a fan of the min-conflicts heuristic for this problem. See eg section 5.3 of http://aima.cs.berkeley.edu/2nd-ed/newchap05.pdf

Re: Typing the technical interview

#29

It's odd. There are people who complain on Hacker News about interviewers who ask about algorithmic complexity: "when are we ever going to need this?" This is about wasting an interview demonstrating a semi-obscure technique that's fascinating but mostly useless, and it gets widely praised. Seems like it's just that fantasizing about turning the tables on an interviewer is fun, never mind whether it makes sense or no…

Do you have no sense of humor?

Re: Typing the technical interview

#30

Sad to say, this is exactly the sort of magic that, as the conclusion suggests, gets people not hired. Even on this very enlightened forum people argue in favour of less knowledgeable candidates (even with all else being equal).

But the solutions shown in this series are just pointlessly esoteric. I'm not actually sure what the point of this series is.
Post reply on HN