5 ms·
Coding questions are not language independent though. You might as well ask to write a monad transformer in a language of their choice.
by bushin 9y ago
Coding questions are not language independent though. You might as well ask to write a monad transformer in a language of their choice.
- chadash 9y agoOf course the question is biased against certain programming languages. For example, in python: def reverse_str(x): return x[::-1] works. If you remember this notation, then you'll have this problem done in 30 seconds or less. But even if you don't remember this notation, I expect a candidate to figure out some way to reverse a string within 5 minutes in some language. I can think of engineering roles that rarely work with strings, but in the roles I hire for, we use them a lot and so I want to know that you have the basics down. If you know that: * strings are simply arrays of chars * how to access an item in an array * how to write a for loop Then you have the tools you need to solve this problem. Are there any common languages where this is a particularly difficult problem (I'm genuinely curious, not trying to be obnoxious... if so, then I might consider changing the question for the future)?
- foo101 9y agoI am with you. Although most modern languages would offer shortcuts to reverse a string but the spirit of this question is to see if a candidate has the mental agility to come up with a solution purely from ones knowledge to use a programming language and common sense. One should be able to devise a solution to a simple problem like this without any CS course at all.
- bushin 9y ago> strings are simply arrays of chars or code units/code points/grapheme clusters/emojis. Thanks to hard work of many developers string handling becomes easier over time, but I don't think it's trivial if you don't exactly specify what you mean by "string" and "character".
- chadash 9y agoI think you and I are arguing semantics then. The very question "what do you mean by a string?" already indicates that you might be familiar with some of the differences between unicode and ascii, for example. In that case, I'll clarify what I mean depending on the language the candidate is most comfortable with. For example, if they plan to use C++, I might clarify that they can assume that the string is an array of chars containing letters a-z. I really just intend it as a filtering question, but someone can definitely get bonus points if they ask intelligent questions to clarify the problem.
- pastage 9y agoYou can't give those answers on computer aided code testing sites. That's why those tests needs to be long, verbose and boring so the questions will be obvious. The human touch.
- nilkn 9y agoI can't speak for chadash, but I'm pretty sure most folks who know to ask questions like this are probably going to pass the interview. They'll ask the right questions, and the problem will be simplified to a form that is solvable in a few minutes. So I don't think this is any major hurdle.