How to nail a quant researcher interview — coding challenge

John M
3 min readJan 26, 2021

In a previous post, I shared my point of view of what kind of qualifications we are looking for in quant researchers (post here: https://johnm14159.medium.com/who-qualifies-as-a-quant-researcher-629486fb5442). However, just like even someone with the talent of LeBron James still has to put in all the hours in the gym to be able to dominate on the court, the perfect quant researcher candidate still needs to get himself/herself thoroughly prepared to perform and make an impression in the interview. As part of a quant interview preparation series, we will focus on coding today.

Know your algorithms, and be ready to reinvent the wheel

Algorithms are just so standard in almost every single coding interview, regardless of whether you are aspiring to be a software developer or a quant. Some argue that algorithms are so fundamental and embedded in so many packages and even developers generally only use them indirectly. It is on the contrary quite critical that quants know their algorithms inside out and are able to reinvent algos on the fly.

This is mostly due to fact that quants are usually faced with highly custom problems that are not so well defined and not so generally solved. Consider binary search as an example. It is easy to call numpy.searchsorted when the input is simply a list of numbers, but no such method exists if one was to search within a parameter space with clear boundaries with nasty functional forms in which the gradients are difficult to calculate.

Know your data structures, and use the right one

Data structures are the second most critical aspect that we usually test in a coding interview. Using the right data structure for certain tasks makes it a night and day difference in code performance. Imagine keeping a simple list versus a priority queue for orders that a strategy potentially can send based on the received data. The list solution would run potentially with O(n) and the priority queue, given the correct choice of priority, would run with O(1) which can be orders of magnitude faster. Needless to say, performance is the key to success to many strategies.

The above is in fact a perfect example relating back to algorithms too — the choice of priority can be quite non-standard (e.g. as a function of more than one variable). As a result, the priority queue needed probably needs to be handcrafted in a custom fashion, making it impossible to call/import commonly used libraries or packages.

Write your code clean, and modularized

This last aspect is something so many candidates overlook and fail to pay attention to in the interview. While ultimately getting the correct solution matters, how one arrives at the solution matters as much in quant trading. I’ve seen countless pieces of the code that does the correct calculation but demonstrates poor logical organization and makes it impossible to follow.

There are practical reasons to favor clean code other than a purely aesthetic concern. Nobody works alone and quants inevitably collaborate with other quants and sometimes developers. A piece of code is also rarely in its final form as the strategy evolves and as people deepen their understanding of the market. Messy code with poor modularization makes it difficult to innovate upon and one needs to be as agile as possible to stay relevant in the highly competitive financial industry.

Of course, knowing these guidelines doesn’t automatically make one pass coding interviews. Eventually, practice makes perfect. I always recommend people to take advantage of websites like leetcode, and one problem a day can easily help one improve gradually and steadily. Hope this is helpful.

--

--