1

I'm about to graduate with an MS in Aerospace Engineering, but most of the jobs I'm applying to require some kind of coding test (HackerRank/Codility) as an initial screen. Unfortunately I've never taken a class on algorithms and data structures, so am looking at ways to improve my skills in these areas. I've picked up "Cracking the Coding Interview", and am currently starting to go through exercises, but have a question. I've only just started, but it seems that the expectations of on-site and online tests would be very different. If we consider question 1.3 (called "URLify") in the above book, it simply asks us to replace all spaces in a string with "%20". If I were to do this in Python, and had been given the following string

s = "Stop it Jeff."

I'd just write

s2 = s.replace(" ", "%20")

But, this seems too easy, so I feel like I'm going about this the wrong way and should try and solve it without the help of built-in functions. However, in online tests it seems that we're unrestricted in how we solve problems, and in on-site interviews they want us to use more fundamental approaches (i.e. using a for loop and other basic functions in the above example). So is it the case then, that I should expect more "difficult" questions in online tests since we can generally use any functions we want, and "easier" questions in on-site interviews with the expectation that you won't use any fancy functions to solve a problem? Difficult and easier are obviously not the correct words to use here, as an "easy" on-site question may be very difficult to solve because of the above mentioned expectations of using fundamentals to solve the problem. Any help would be much appreciated, as I'm quite confused as to how to proceed.

closed as primarily opinion-based by DarkCygnus, paparazzo, Masked Man, Michael Grubey, gnat May 1 '18 at 18:24

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Do Aerospace Companies follow the SV fads - also why are you applying to web dev companies (as is apparent from the Q you give) Also you would just use the appropriate existing urlencode function not write one your self – Neuromancer Apr 30 '18 at 22:28
  • "But, this seems too easy, so I feel like I'm going about this the wrong way and should try and solve it without the help of built-in functions." - There are many principles in programming, one being KISS (Keep It Stupid Simple). Simple is most of the times better. Besides, using the replace method is quite standard, why bother doing it with for loops when you can do it that way? Doing that would be basically reimplementing the replace method. I feel that perhaps you are over-thinking this one a bit, so I suggest you keep confident in what you know instead of what you don't – DarkCygnus Apr 30 '18 at 22:52
  • @Neuromancer: yes, since I currently live in SV unfortunately everyone seems to think engineering grads == CS grads. I'm applying to small aerospace startups and autonomous driving companies and they all seem to do coding interviews. – InquisitiveInquirer May 1 '18 at 1:13
  • 1
    I think if you carefully read the intro to the section and the problem statement (which makes references to holding enough space at the end of the array and stating that if you're using Java -- a language that like python has immutable strings-- to assume you are using a string buffer), you'll find that the way you're approaching the problem is incorrect. Given the context, I'm fairly certain the interviewer would flunk you. Has nothing to do with being onsite or not. – Chan-Ho Suh May 1 '18 at 2:01
  • 1
    You'd think if you're working with engineers/programmers, they would be more explicit in what they want you to do.Someone who writes their own version of common functions could be a risk for wasting time and money. – user8365 May 1 '18 at 14:33
2

Yes, they are different

An online coding test is intended to let the recruiters screen out bad applicants or to rank applicants so they can consider the 'best' ones. It is essentially pass/fail, because you're not able to explain what you're doing to the recruiter.

An in-person test is much more interactive; you can explain why you are doing something, or ask for a detail you need but don't have, or ask for clarification of the task or question. In person they are hoping to see your approach, your thought process, rather than just whether you can do a puzzle or not.

Don't overcomplicate things

If you get a question 'replace all the %20 with space', then just use the built-in function. If they want you to code it by hand, they will say so. Anything that you can do in a simple and straightforward fashion that has not been forbidden is fine.

You'd be surprised how many people who apply for coding jobs cannot write code at all. Sometimes they're just asking you a very simple question.

In person, investigate the problem

Online tests have to be specific about the problem they want you to solve, but in person the interviewer can just make vague requests, like 'can you write code that replaces %20 with spaces' without specifying what inputs to expect. It is worth just checking the parameters of the task; will the code need to cope with arbitrarily long strings, alternate encoding choices, empty strings, etc etc.

This is a double-edged sword; you might look good for trying to establish such things before you dive in, but they might just say 'yes' to whether you need to cope with X, so don't skewer yourself with it.

  • Yes this - really online and on-site tests are looking at a (slightly) different set of skills. – marcus.greasly May 1 '18 at 0:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.