Hacker News new | past | comments | ask | show | jobs | submit login

My favorite job interview question was this one. The conference room had a projector on the whiteboard with this:

    char *c[]= {"ENTER", "NEW", "POINT", "FIRST", };
    char **cp[]= {c + 3, c + 2, c + 1, c};
    char ***cpp= cp;
    main()
    {
        printf("%s", **++cpp);
        printf("%s ", *--*++cpp + 3);
        printf("%s", *cpp[-2] + 3);
        printf("%s\n", cpp[-1][-1] + 1);
    }
I just happened to be recently studying all the operator precedence rules and other subtleties in that code, so I got it all right. (Probably wouldn't do as well today :-)

But mainly it was there as a point of discussion to see how you approached such code.

And like most conference room whiteboards, most of the pens were dried out. I tossed those into the trashcan.




"But mainly it was there as a point of discussion to see how you approached such code."

One would hope that the expected answer was to approach it by way of promptly deleting it, replacing it with something readable, and then finding the person who wrote it and kicking them in the shin at least 8 times.


How are you going to know how to replace it unless you can figure out what it does?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: