Ten tips to solve your next interview coding challenge

Ten tips to solve your next interview coding challenge

While applying for a new job, often we’re given a coding challenge. A medium-size coding task to finish in a couple of hours or days. These are my tips to solve your next interview coding challenge.

When solving interview coding challenges, write code as clean as possible. Write good and consistent names. Keep your solution under version control. And, document major design choices and installation instructions.

TL;DR

  1. Follow good practices and stick to coding standards.
  2. Keep your solution under version control.
  3. Write a README file with installation instructions.

1. Stick to standards

Follow good practices and stick to coding standards. Write clean code.

Write descriptive names. Don’t use Information or Info as name suffixes. Like, AccountInfo. And keep names consistent. If you used AddAccount in one place, don’t use AccountAdd anywhere else.

Use one single “spoken” language. Write variables, functions, classes, and all other names in the same language. Don’t mix English and your native language. If your native language isn’t English. Always prefer the language you will be using at the new place.

Don’t keep commented out code. And, don’t have extra blank lines. Use linters and extensions for this.

Use third-party libraries to solve common problems. But, don’t keep unused libraries or NuGet packages.

Have clearly separated responsibilities. Use separate classes, maybe Services, and Repositories. But, stay away from Helper and Utility classes full of static methods. Often, they mean you have wrong abstractions.

Add unit or integration tests. At least for the main parts of your solution.

If you're new to unit testing or want to learn more, I have the Unit Testing 101 series and one free eBook on the subject. Don't miss them.
Framed wall art
Write code you would print and hang in a wall. Photo by Lefty Kasdaglis on Unsplash

2. Version Control your solution

Keep your solution under version control. Use Git.

Write small and incremental commits.

Write good commit messages. Don’t use “Uploading changes”, “more changes” or anything among those lines.

If you're new to Git, read my beginner's Guide to Git. If you know TFS, check my Git guide for TFS users.

3. Write a good README file

Write a good README file for your solution. Don’t miss this one!

Add installation instructions. Make it as easy as possible for the one reviewing your work to install and run your solution. For example, deploy your solution to a hosting provider or use Docker.

Add how to test your solution. Maybe, some step-by-step instructions with screenshots, a Postman collection with the endpoints to hit. You get the idea!

Tell what third-party tools you used. Include what libraries, NuGet packages, or third-party APIs you used.

Document any major design choices. Did you choose any architectural patterns? Any storage layer? Tell why.

Voilà! These are my best tips to rock in your next coding challenge. Remember, it’s your time to shine. Write as clean code as possible. And keep things consistent. Good luck!

Get ready for your next interview with these tips for remote interviews. And, to prepare for your technical interviews, check how to evaluate a postfix expression, how to solve the two-sum problem and how to shift array elements. These are real questions I got on previous interviews.

Happy coding!