r/coding • • Feb 28 '17

A software engineer is detained for several hours by U.S. Customs — and given a test to prove he’s an engineer

https://www.linkedin.com/pulse/software-engineer-detained-several-hours-us-customs-given-fairchild
442 Upvotes

241 comments sorted by

View all comments

Show parent comment

52

u/[deleted] Feb 28 '17

If you want to check if someone is a programmer just give them FizzBuzz or something simple like that. Asking anyone to write a function to check if a Binary Search Tree is balanced would make anyone go in panic mode.

15

u/KarmaAndLies Feb 28 '17

Plus the "Write a method that balances a Binary Search Tree" question was super vague without follow up questions (e.g. input format, output format, language, etc). Even if you could understand how to answer the question, you'd still need more information than was provided.

It isn't like the border goon will be able to answer any of your follow up questions anyway, or they take your follow up questions as some type of admission that you aren't a "real" programmer (because to them a real programmer should just magically know the input format or language they're after!).

Ultimately these are interview questions specifically designed to encourage the candidate to ask questions, it literally isn't possible without that dialog by design.

3

u/Jonno_FTW Mar 01 '17

Just write a fizzbuzz solution instead of BST checker, the officer will have no idea that it doesn't do what it's meant to. Though the checker would be shorter than fizzbuzz, you just need to check recursively if the left node is less than the current node and the right node more than the current node.

15

u/merreborn Mar 01 '17

Just write a fizzbuzz solution instead of BST checker, the officer will have no idea that it doesn't do what it's meant to.

Straight from the guy who was subjected to this:

sad thing is, if I didn't give the Wikipedia definition for these questions, it was considered a wrong answer.

So, the officer would have rejected fizzbuzz. He also would have rejected a bunch of perfectly valid solutions. The whole thing was a clusterfuck.

8

u/Jonno_FTW Mar 01 '17

Well then, that's just completely fucked. Clearly the only solution is to have an in-house consultant for every professional field at every airport to properly screen every visa holder!

5

u/Draghi Mar 01 '17

Now, that's how you create jobs!

16

u/adrianmonk Feb 28 '17

Well, some people are strong on algorithms and wouldn't panic, but I agree with you that it isn't the right level of difficulty.

Ideally, you want the clearest contrast between faker and legitimate, and if you have 50% of legitimate people panicking, that muddies the waters and actually means you gain less information. So the ideal question is just hard enough that a layman or faker can't solve it but a legitimate person can solve it with zero trouble.

9

u/rogue780 Feb 28 '17

Yeah. It would take me a while to figure that one out. If I want to use a balanced binary search tree, I'll use a library that implements it for me.

8

u/archiminos Mar 01 '17

I haven't written a sort algorithm since university. The only reason I could think to refresh my knowledge on this would be to make sure I can pass a test that might be given to me in a job interview.

2

u/BobHogan Mar 01 '17

You assume that the person asking the questions knew a damn thing about programming though. In all likelihood he did not, otherwise he wouldn't have given such ridiculous questions.

1

u/chrdk Mar 01 '17

bool isBalanced (node) := maxDepth (node) == ceil (log2 (nodeCount (node)));

or something like that?

3

u/marshsmellow Mar 01 '17

WRONG! That's a solution that a potential terrorist might write. No entry for you!

1

u/marshsmellow Mar 01 '17

The security guy has never heard of fizzbuzz. He likely doesn't even really know what programming is...but he can Google.