2 ms·
I've seen the same thing. I hire a lot of embedded engineers and when I need someone that has solid experience with drivers and bit-level work, I'll ask a simpl
by joezydeco 6y ago
I've seen the same thing. I hire a lot of embedded engineers and when I need someone that has solid experience with drivers and bit-level work, I'll ask a simple question to start off. In the past I've never disclosed the question, but why the hell not now. I didn't write it anyway:
Given a 32-bit unsigned integer, return true if the binary representation has two consecutive ones in it.
And...that's it. And people that have passed the recruiter gates and made it through the phone screen just completely lose it here. Let's be clear - I really don't care how you do it. There are 3-4 ways right off the bat ranging from a state machine to a shifting mask all the way down to a single inline math statement.
If you're as comfortable as you say, it will be a no brainer. As a check I took an intern and told him to meet me in a conference room to get the same stress level out of him. I posed the problem and got an answer in five seconds.
- heavenlyblue 6y agoWhat is a single inline math statement?
- addaon 6y ago!!(n & (n >> 1)), I assume.
- joezydeco 6y agoBonus points for the boolean sanitation! Now let me tell you about the candidate that wanted to turn the integer into a character string and then search the string for “11”...
- heavenlyblue 6y agoThe solution gives you an answer if there is “at least two”, not two exactly? However I understand that may be part of the discussion afterwards.
- joezydeco 6y agoLike I mentioned above, most of the time it never got that far. Candidates were messing with string handling and converting base-10 integers into binary (not understanding that the machine already had the integer represented in binary)
- Jach 6y agoHeh, I'd accept it. In screening I used to ask them to implement an isOdd() function for an unsigned int, and after they did it (never had someone fail) see if they could come up with alternate ways. Mainly to see if they're aware of bitwise operators, though it's nice to see they can write loops too. It wasn't a fatal flaw if they weren't (it would be if they couldn't solve it in any way), but knowing is better than not knowing. Anyway one person who didn't know nevertheless amused me by doing a conversion to string and checking the last digit. After years of asking the same questions to intern candidates and to senior+ candidates, interns did consistently better. There are a lot of "experienced" but not very skilled people out there. They exist already inside ompanies too (Principle level checking in hundreds of lines of code with many classes and tests, purportedly to add logging support to something, but the code was ultimately a NOP as it did nothing) but even if it's impossible to put out the tire fire it's best not to contribute to it.