peteris.rocks

Interview questions

Interview questions and problems I have encountered in my professional life

Last updated on

When I read /r/cscareerquestions, it gives me the impression that all companies in Silicon Valley only ask algorithmic questions at job interviews.

My experience as someone living in Europe is that you are generally given a project to complete at home or on-site. Then they take a look at your code and decide whether to give you an offer or not.

Here are the questions and tasks I've been given at job interviews in my career.

If there's a Skype interview before the on-site interview, it means I interviewed for a company in another country.

Webdev shop (2012)

This was my first ever proper job interview where I sent in my CV, dutifully did the take-home project and got an offer. It was after I returned from studying abroad and was looking for a part time job while finishing my Bachelor's degree.

I was offered a part-time job but I declined it because I went to work for another company, the next one on this list.

Review HTML/CSS/JavaScript code

The first task was to take a look at an order form written in HTML/CSS/JavaScript and point out everything that I see looks wrong and offer my suggestions to fix it.

Here is a snippet:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>EDU</title>
    <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
    <link rel="stylesheet" href="base.css" type="text/css" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="base.js"></script>
</head>
<body>
    <div id="page-wrapper" style="border:1px solid silver;">
      <h1>Pasūtījuma forma</h1>
        <div id="errors" style="color:#EB8282;"></div>
        <form action="index.html" method="post">
            <div class="row">
                <label>Vārds, Uzvārds: <font color="#F35151">*</font></label>
                <input type="text" name="full-name" value="" id="full-name" />
                <div class="clearfloat"></div>
            </div>
...

I pointed out that, you should have <meta charset="utf-8"> before <title>, the official JavaScript MIME type is application/javascript not text/javascript, you should not use inline styles and the <font> tag, etc.

Registration + login in PHP

The other task was to create a basic CRUD app in PHP that lets users sign up and log in. You should check whether a username is taken with AJAX. After registration, a confirmation email should be sent. When you're logged in, you should see the latest news taken from a remote RSS feed and parsed using PHP DOM libraries. The HTML should also be generated with PHP DOM.

I didn't use any frameworks or libraries, but followed basic MVC principles. I think I named the router FrontController. I also included CSRF and rate limiting.

Language technology company (2012)

This is a language technology company that builds natural language processing and machine translation tools for the Baltic languages.

I had two hours to solve the three tasks below on-site.

Latvian inflector

Latvian is a highly inflected language, meaning that words have many different word endings. I had to create a Latvian noun and adjective inflector in C# using OOP princples.

Luckily, I know Latvian grammar by heart and as a native speaker I recreate the following noun declension table easily:

Declension I II III IV V VI
Nominative -s -is -us -a -e -s
Genitive -a -a -us -as -es -s
Dative -am -im -um -ai -ei -ij
Accusative -u -i -u -u -i -i
Locative
Declension I II III IV V VI
Nominative -i -i -i -as -es -is
Genitive -u -u -u -u -u -u
Dative -iem -iem -iem -ām -ēm -īm
Accusative -us -us -us -as -es -is
Locative -os -os -os -ās -ēs -īs

It's actually a little more complicated than that but I basically had to turn this table into OOP code.

Orientation of a polygon

This was an algorithmic question.

I had a list of points and I had to print whether the orientation of the polygon that was made up of these points was clockwise or counter-clockwise.

I think I couldn't figure out the solution.

Word problem

Two people had pens, pencils and erasers and I had to figure out how many erasers the second person had, I think. It was a simple middle school math problem that can be solved with a simple equation or just brute forced.

Apparently, there was no catch but still many people can't solve it.

Local directory service (2014)

When an ex-boss sends you a message on Skype (that you never use), what's the first thing that comes to your mind? In my case, I immediately started worrying that my code that I wrote three years ago no longer works.

But it turns out he was now at a different company and was looking for developers.

The take home task was supposed to be a simple MVC CRUD app in PHP.

I declined to do the task because they offered to pay under the table.

Charts library startup (2015)

I didn't apply for this job but I wanted to see if I can solve this interview problem.

You need to create an HTML page with a 20x20 grid of rotating doughnut charts.

I had to read up on requestAnimationFrame otherwise my CPU fan got way too loud.

Here's my solution.

Language technology company (2015)

I didn't apply for this job but I tried my hand at this interview problem.

It's a machine learning classification task. You have 16 numeric features (named F1 to F16) and a binary label.

Your task is to

The dataset was generated in Excel (random numbers, some were linear combinations) and you could easily get a 100% accuracy with most algorithms.

Large tech company (2015)

First Skype interview consisted of various questions

This was insanely fun. First, you'd need to look up domain.com using DNS. I had prepared for this so I talked about the whole path down to the network layer. Not mentioning ARP and routing tables would be a red flag. Then you'd need to establish a connection over TCP but which port? It's usually 80 but it could also be 443. I talked about the HSTS header, HSTS preload list and certificate pinning, etc.

Second Skype interview was a coding interview

I was told I passed both interviews and the next step was supposted to be an on-site interview.

But my emails about the next steps went unanwered even when I tried a year later.

Startup (2016)

I applied for what I guess was mostly a front-end developer position.

I had two quick coding questions in the Skype interview.

I was then invited to an on-site interview.

The task on the interview day was to create a small application that has coordinates x, y in a table on the left and a graph with these points on the right. When you click on the graph, a new point is added. Or you can add it to the table.

Bonus features (pick two)

I chose realtime and unit tests.

Fintech startup (2016)

This is a fintech startup that tries to classify transactions on your credit card statement.

They had a challenge on their website where they give you a small sample of their data and you need to create a machine leraning solution to classify the transactions in five categories (food, restaurants, transportation, utilities and other).

Fun, right?

Except the training data was not labeled. They wanted you to label all 6000 transactions yourself. What if a transaction is ambiguous: is it food or restaurant? You can clarify that with them by email.

They would compare your results with their hand crafted algorithm that's got >95% accuracy.

The prize was €200 and possibly a job opportunity.

When communicating with them, I got the impression that they did not know what they were doing. I learned later that I was completely right.

Monea (2016)

If you want interviewees to badmouth your company every chance they get, do what this company did.

Swedbank (2016)

There was an encrypted message in the job posting and you had to decrypt it (it was Base64) and follow the instructions. I wrote about it on my blog here.

I had a non-technical Skype interview with Swedbank but the interviewers looked bored and I wasn't really gunning for a penetration testing position so I didn't get an offer.

Social network startup (2017)

There were three Skype interviews.

Missing numbers

You have an array of numbers from 1 to n. One number is missing. Find which one.

I solved it because I'd practiced this problem and seen others' solutions on Leetcode.

Calculator

We want you to create a simple calculator that can add, subtract, multiply numbers. Keep in mind that we may want to add abitrary new operators/functions in the future. You can have the input in any format that you want.

I started to talk about the postfix notation and the shunting-yard algorithm (whose name or implementation I did not know) but they started to stress the importance of adding new functions.

Then it occurred to me that I can write a simple Lisp interpreter.

I could solve this because I'd tinkered with writing insignificant toy parsers before and I'd read Peter Norvig's article.

Webdev questions

This was another Skype interview, this time with the CTO.

Feature

At the on-site interview, I had to add a small feature to their codebase.

In their product, they have a chat very much like Facebook Messenger. It's basically a copy of it.

They wanted me to add statuses to each chat message (sending, error, received, read). Just like on Messenger.

I implemented a hackish (which I was encouraged to do) solution that did not work. My problem was that the feedback loop was very slow (it'd take a minute for me to make a change in code and see it reflected in the browser) and I started on the wrong path and did not have time to finish with a clean solution.

I didn't think I'd get an offer but I actually did. I declined because I went to work for another company.

Summary