DEV Community

Top 20 String Coding Problems from Programming Job Interviews

javinpaul on June 01, 2019

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided i...
Collapse
 
beachbc profile image
Bradley Beach

"Thank you for selecting me as a candidate to interview, if you honestly think I've worked my way up to being a senior developer without knowing how to actually perform the job, then this isn't an organization I want to work for. I'm sure we both have more important things to do with our time, so why don't we go ahead and end this now."

Collapse
 
javinpaul profile image
javinpaul

Well @Bradley, I do understand that after a certain level of experience you may find it offending solving these questions but that's not the goal. If you are hands-on with coding, you can easily solve these problems but if you struggle with solving these, it means you are a bit rusty and not really doing coding everyday.

Collapse
 
beachbc profile image
Bradley Beach

It doesn't matter to me how easy the questions are to answer. To me:

The question is trying to verify that I know how to do trivial and/or esoteric operations off the top of my head, which lets be honest, who has ever had to reverse the words of a sentence? Likewise, who hasn't had to strip bad characters out of a string?

The interviewers care about my rote memorization, which has nothing to do with being a good developer.

The company put someone in charge of interviewing that isn't a developer and they pulled questions off the internet thinking this is what makes a great developer.

The person in charge of hiring is too busy or too lazy to put the time into determining if a long list of candidates are a good fit for their organization, so they use this as a quick way to weed out candidates in round one. Mission successful; if they're not going to put the time into selecting quality candidates then right off the bat I'm not too excited about my prospective coworkers, nor the support I can expect from the organization.

What I'm saying is that a company asking this type of question tells me all I need to know about that company.

About the most I'll do is some sort of take home project and discuss at the interview: at least then I can either use a language or library I haven't used in a long time or learn a new one while I'm doing the project so that I'm not wasting my time.

Thread Thread
 
philrod1 profile image
Phil

Exactly! Job interviews are a two-way thing. Or at least they should be.

Collapse
 
mt3o profile image
mt3o • Edited

Horrible idea for a job interview. Perhaps for a junior position, or even for an internship, but not for a senior, or at least for minimally independent position. All of those problems are easily solvable with Google.
On the other hand, as a senior, you have to work with multiple different languages, technologies, paradigms and be able to to figure out best way to solve the problem, having multiple proposed solutions. Problems you referred are trivial, well known and deeply exploited.

From my experience, I had people who excelled at this kind of questions but failed at "as a java developer i won't touch js/html" kind of test. As a scrum master and main developer on the team I cannot accept situation where one of the members can't (don't want to) handle tasks other people do.

As interviewer I like this question: which features of java8+ are most important to you?
It gives the interviewee chance to gather thoughts, check if he is up to date and on which parts of the language he focuses. And there is no "bad" answer. All answers reflect how they think, what they focus on, and, honestly, if you rate people's creativity by number of algorithms they memorized, you'll assemble a team of losers who can't solve any problem unless it's already solved by a business analyst.

I don't want to work for you. Sorry.

Collapse
 
mia26mba08 profile image
Shafiq

Possibly the worst way to hire someone. They give zero indication of a devs ability.

Collapse
 
javinpaul profile image
javinpaul

I don't know why you think so because this is not the only interview anyone will give to get the job. It's not that easy. this is just a part of a big hiring process.

Collapse
 
philrod1 profile image
Phil

The java example of reversing a string in-place is wrong. Strings are immutable in Java. The example given will involve two array copies.

Collapse
 
javinpaul profile image
javinpaul

Well, while you are correct, it's about logic. In reality, it's better to use StringBuilder.reverse() but yes, mentioning that fact can impress some interviewers too.

Collapse
 
humbertobeltrao profile image
humbertobeltrao

I think that trying to let things clear during the interview helps the candidate to understand the importance behind these kind of questions. In one of the process I participated the interviewer explained that solving the string problems I was facing was not the point. He explained the time constraints the projects used to demand in the company and for that reason code performance and complexity concerns would be also evaluated. String problems themselves probably do not represent the scenario a candidate will be working on, but perhaps telling about the skills required to not hit the iceberg helps to care about its top.

Collapse
 
mt3o profile image
mt3o

For comparison, look here:
businessinsider.com/how-tech-compa...

If paywalled, disable javascript.