We would like to get to know your coding style and see what you would consider your best work. In subsequent interviews, we'll talk through your code and make some changes.
Implement a command-line reverse polish notation (RPN) calculator using a language that you know well.
We're building this command-line calculator for people who are comfortable with UNIX-like CLI utilities. We are starting with the basic 4 operators now but will want to eventually implement other operators and an alternate interface (such as WebSocket, file, or TCP socket). There's no need to implement these, but design with these future changes in mind.
q command or an end of input
indicator (EOF / Ctrl+D)You may take creative liberty with anything else; have fun with it!
The format is not important, as long as it makes sense.
> 5
5
> 8
8
> +
13
> 5 8 +
13.0
> 13 -
0.0
> -3
-3.0
> -2
-2.0
> *
6.0
> 5
5.0
> +
11.0
> 5
5
> 9
9
> 1
1
> -
8
> /
0.625
These hold true both for this submission and for your work here in general. We expect that:
There are a range of expectations from various companies in their interviewing code exercises, from minimal code to get the job done and prove you can program, to expecting exemplary code that demonstrates how well you can design things when the occasion requires it. We tend to judge toward the latter end of the spectrum, assuming that anyone who can write well-crafted code can also scale down quality to do things quickly, but not necessarily the other way around. With a large multi language codebase, we want people who can work with us to raise the bar of quality.
Write your README as if it was for a production service. Include the following items:
Submit your code as a git repository (even if 1 commit). The more commits, the better. Host it on GitHub (or wherever, public or private), or send it as a zip file/tarball.
If you think this note resonated, be it positive or negative, send me a direct message on Twitter or an email and we can talk.