Five programming problems every Software Engineer should be able to solve

Njabulod

Well-Known Member
Joined
Nov 11, 2012
Messages
351
Reaction score
1
Location
Pietermaritzburg
Five programming problems every Software Engineer should be able to solve in less than 1 hour

https://blog.svpino.com/2015/05/07/...r-should-be-able-to-solve-in-less-than-1-hour

Excerpt:
Can you actually code anything?

For my Software Engineer position I'm usually expecting you to be able to code something. I'm talking about real code here: I give you a problem, and you write a solution for it using any programming language you feel confortable with.

Do you think you can actually do this?

Here is the deal: if you can't solve the following 5 problems in less than 1 hour, you may want to revisit your resume. You might be great at doing whatever you do today, but you need to stop calling yourself a "Software Engineer" (or Programmer, or Computer Science specialist, or even maybe "Developer".) Stop lying to yourself, and take some time to re-focus your priorities.

So how fast can you do this?

The 5 problems

(The following problems are ridiculously simple, but you'd be surprise to discover how many people struggle with them. To the point of not getting anything done at all. Seriously.)

Problem 1

Write three functions that compute the sum of the numbers in a given list using a for-loop, a while-loop, and recursion.

Problem 2

Write a function that combines two lists by alternatingly taking elements. For example: given the two lists [a, b, c] and [1, 2, 3], the function should return [a, 1, b, 2, c, 3].

Problem 3

Write a function that computes the list of the first 100 Fibonacci numbers. By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two. As an example, here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and 34.

Problem 4

Write a function that given a list of non negative integers, arranges them such that they form the largest possible number. For example, given [50, 2, 1, 9], the largest formed number is 95021.

Problem 5

Write a program that outputs all possibilities to put + or - or nothing between the numbers 1, 2, ..., 9 (in this order) such that the result is always 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100.
 
Last edited:
No time either, but it's not hard. I can do the first four in my head. I ran out of Friday juice reading the last one.
 
I was expecting something difficult but those were crazy easy problems. In fact, we did some of those questions way back in school in Turbo Pascal.
 
Yah, those are not difficult at all.

Do folks actually apply for jobs not being able to do basic loop logic, array manipulation and simple code?
 
Yah, those are not difficult at all.

Do folks actually apply for jobs not being able to do basic loop logic, array manipulation and simple code?

What I was thinking too.
 
Did the first 4 in my head, last one is for Monday!
 
I recall a couple of years ago that IT wanted to recruit new programmers. They interviewed them. The second interview was to write a program and fix a program (really simple errors in it.). It was scary to see how many candidates didn't make it through the 2nd interview. Basic stuff. Really basic stuff

So. I like this person's approach. Not just coding or using frameworks. Solve a problem (or 5) as well
 
Yah, those are not difficult at all.

Do folks actually apply for jobs not being able to do basic loop logic, array manipulation and simple code?


Unbelievably, yes.

I interviewed a guy who couldn't remotely do this and claimed he has never had to deal with this. I told him to leave and stop wasting my time
 
Ok.... thank heavens I've never had one of those cross my desk but I think I've done a decent job over the years interviewing/criting candidates.
 
If I am going to be completely honest the last two would probably slow me down a bit.

There was a stage early on in my career when I could do puzzles like this in my sleep but 15 years of real world development have blunted those skills.

Ask me when to use a dictionary or hash table to optimize a lookup. Ask me how to implement a trie structure for a cache. Ask me how to profile and optimize SQL or properly design an SQL schema so that it doesn't turn into a birdsnest. Ask me about how to properly design a robust maintainable system.

I'm afraid that I also think the piano tuner problem is also a crock. All it shows is that you have read about the piano tuner problem on the internet.

Anyway, I'm just grumpy tonight.
 
So you only need to be able to do the above to be considered a software engineer/coder/developer/....?

The author is stating a necessary condition, not a sufficiency condition. It's just a litmus test for basic algorithmic skills, nothing more.
 
One of my interview questions is how to explicitly (closed form) compute the Nth Fibonacci number (O(1)), using linear algebra to derive it. For mathematical candidates only of course.
 
One of my interview questions is how to explicitly (closed form) compute the Nth Fibonacci number (O(1)), using linear algebra to derive it. For mathematical candidates only of course.

I take it that entails something more than just a recursive function ?
 
Top
Sign up to the MyBroadband newsletter
X