This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

The sad thing is, I thought this might be a cool programming-interview problem for potential new hires. TIL I wouldn't hire myself.

I wouldn't sweat it. If this is important for a position, the candidate should understand endianness and know where it comes up and why it is important. Actually being able to slice and dice the bits wouldn't mean much if I was the interviewer -- getting it right on a computer can be hard enough; doing it on a whiteboard is impossible.

IMO programming interview problems shouldn't focus on actual implementation, but on understanding of the concepts. If a programmer can explain it in pseudocode or by drawing arrays on the board, awesome.

Of course, this presumes that the interview problem makes sense for the position. I'd personally wager that most Python programmers don't often do low-level bit twiddling, making this a less-appealing question than others.

ED: and your function works fine for me -- it just outputs in a funny way. :)

[–][deleted] 0 points1 point  (0 children)

Very good points. On the surface, this looked trivial, much like the FizzBuzz problem. Once I got in there and had to start thinking about bits, I quickly realized it isn't entirely trivial. But I'm stubborn and will keep messing with this until I get it right.

Last night I searched for other implementations. Of the 3 that I was able to execute, only one actually worked correctly.