Only do a code challenge if it takes a <=4 hrs. If it takes longer than that, then make sure it's a substitute for the onsite whiteboard portion. If they're using a code challenge, in addition to the whiteboard interview, and as a first pass filter, walk away.