Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was recently asked to write some sample code that solves a difficult technical problem. I've been mulling over what kinds of problems might be good to solve in code to demonstrate my skills in such a situation.

I've seen similar posts discussing what reviewers are looking for in the context of code interviews, but I'm interested in the specific problems that might be good to solve. For example, this blogger offers the following sample code ideas:

  • A utility class for logging events and errors either to a file or the system event logs with a configurable level of verbosity.
  • A set of stored procedures for maintaining and searching data in a hierarchical tree structure.
  • An implementation of the singleton design pattern to serialize access to a resource file.
  • A calculator function that takes a single string of input that includes numbers and operators and returns the numeric result of the equation. Don’t forget input validation, error handling (divide by zero), and operator precedence concerns!
  • A method that takes a URL to a web site and a local path and downloads all image files based on tags.
  • Create a method that takes a keyword, message, and login credentials and uses the Twitter API to respond to post the message as response to any friends of the account specified.

I'd like to see these types of examples, perhaps with a harder technical problem. Ideally example problems would support demonstrating understanding of Java constructs/data structures and the Mode-View-Controller (MVC) paradigm.


I was able to find a nice website called Project Euler which has all kinds of neat problems, many of which could fit this need. It has some great brain food to go along with whatsisname's answer.

Obviously the goal here is to find samples of the kinds the problems that would be good to solve in this situation, not to copy and paste code (especially if it is not yours!).

share|improve this question

closed as not constructive by JeffO, tdammers, Karl Bielefeldt, Martijn Pieters, World Engineer Mar 25 '13 at 0:06

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Asking for a list of things or "what should I do" questions are off topic here. As I said in my answer to this related question, the best examples are unique enough that you couldn't have copy and pasted it. –  Karl Bielefeldt Mar 24 '13 at 21:50
duplicate of Where can I find programming puzzles and challenges? –  gnat Mar 26 '13 at 21:23

1 Answer 1

up vote 0 down vote accepted

From my previous job hunting efforts, I found old questions to ACM Programming Contest questions, and found those to be good sample material.

They are small enough to be implemented in a single file reasonable, but hard enough that the resulting sample isn't something trivial, and at the same time, it is a mostly self-contained sample program.

The downside to them, is they focus primarily on the math and problem solving, with a hard focus on computer-sciency problems, and don't do much of anything to demonstrate familiarity with APIs, databases, or other important aspects of commercial software.

share|improve this answer

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