Skip to content

Instantly share code, notes, and snippets.

@geluso
Last active May 1, 2019 23:14
Show Gist options
  • Save geluso/acb0da66adbf9a7b46c2fb35fd1dabb6 to your computer and use it in GitHub Desktop.
Save geluso/acb0da66adbf9a7b46c2fb35fd1dabb6 to your computer and use it in GitHub Desktop.

Practicing Whiteboard Problems

Resources

Finding good practice interview problems can be hard. Where should you begin?! How do you know if the question you're being asked is a "good" question?

Here's one persons candid opinion about the websites listed under Resources above. Advent of Code is my favorite.

Advent of Code

In short: excellent resource with interesting story problems. It does not provide you with canonical solutions, but there's communities dedicated to discussing solutions. Advent of Code is programming-language agnostic. It does not run your code. You write and run code on your own machine then copy and paste an answer for it to verify on the website.

Geeks for Geeks

I've seen this site popping up more and more. It offers lots of good problems, especially for data structures and it provides solutions. It does a good job of describing algorithms to solve problems. Most solutions are written in C (or something) so you may not see solutions in your preferred programming language.

Code Wars

Here's a website with a vast variety of problems! Problems are categorized with difficulties. It allows you to write code and execute your solution on their own website. They have sample input and test cases configured so you know for sure when your solution is correct or incorrect.

Code Wars's variety is its strength and it's weakness. You may find esoteric problems that are strangely written or force you to perform exotic tasks. For instance, this problem asks you to produce a certain output and then it asks you to try to compress your source code to be less then 100 characters. These kinds of problems are fun and interesting, but they definitely don't have you practicing wholesome fundamental programming techniques.

Code Wars is great but it can be hard to tell if you're working on an actually good problem, or if you're being sent on a bat-crazy fools quest.

Project Euler

In it's own words

Project Euler is a series of challenging mathematical/computer programming
problems that will require more than just mathematical insights to solve.
Although mathematics will help you arrive at elegant and efficient methods, the
use of a computer and programming skills will be required to solve most
problems.

The motivation for starting Project Euler, and its continuation, is to provide
a platform for the inquiring mind to delve into unfamiliar areas and learn new
concepts in a fun and recreational context.

Project Euler is a great bank of problems. The one thing I don't like about it is some of the problems get too mathy and I simply don't like them. Maybe you do!

For example one problem asks you to find the 1001st prime number. Ok, I understand that and it makes sense. Other ones simply talk very mathy about things I don't quite understand and absolutely don't find interesting.

So, Project Euler is a good resouce, but I just don't personally like the genre. Remember, this is an opinionated text you're reading!

Advent of Code

First things first: I want to point out that Advent of Code is an awesome resource. I can't praise this place enough. The website presents you with sequential challenges where you have to solve each one before you're presented with the next. Working through all the problems is satisfying.

Advent of Code is language-agnostic. It doesn't care what programming language you use to derive your solutions. In fact, Advent of Code doesn't execute your code. It presents you with a story problem, asks you for an answer and verifies your solution. It's up to you to interpret how to approach each problem and what data structures (or programming language!) is the right tool for the job.

Each challenge is split in to two parts. Usually the first half gets your set up with the basic idea of the problem so you have a chance to program a foundation. Then the second half adds a twist. You have to modify your first half somehow in order to find the solution to the second half. Sometimes the modifcation is simple. Sometimes you find you have to rewrite the entire thing!

The two-part challenge approach is not uncommon in real-world interviews. Someone may present you with a problem, see if you can solve it, then add a complication and see how you modify your original solution to solve the new twist.

General Practice Tips

Here are some tips for preparing for interviews.

Review Every Problem You've Ever Seen

If you've taken a class with data structures and algorithms gather up every problem you've ever been presented with and work through them all again. Most importantly: work through them using only pen and paper! DO NOT use your computer when you're practicing. Force yourself to rely on what you remember without sporadically lookings things up online. Build the muscle memory of writing out your programming language by hand.

Look Up "Interview Questions"

Now that you've practiced every problem you've ever seen it's time to broaden your horizons. Fire up your search engine and look for variations of "programming interview questions."

Use your best judgement about what constitutes a good problem, or problems you're interested in solving. Some problems might be too mathy. Some problems might be ill-defined. Some problems might be asking you to perform algorithmic acrobatics you don't even want to acknowledge. Sometimes you'll find a problem that makes total sense in the problem statement, then when you look at the example solution code you can't make heads or tails of what they're doing. Through all your results you'll be sure to find at least some new problems and solutions that expand your horizons.

Go Out and Take Interviews

Nothing beats real-world experience. Apply to companies, talk on phones, join video chats. See what people are actually asking during job interviews.

You're bound to face problems you can't solve. Hopefully you'll be able to take something away from those ones. You're bound to have problems that you crush! You're bound to find those goldilocks problems that offer a perfect challenge.

Talk to Your Peers

It's fun and beneficial to swap war stories with your peers. Make it a point to talk to your peers to hear how their real-world interviews go, hear what sort of problems they've been asked and be sure to share your experiences too. If you have a good group of friends all looking for jobs you can scope out what sort of questions everyone is asking these days much more broadly than you can alone!

Rinse and Repeat

Do all these things over and over again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment