u/HelpfulBuilder6964

Passing LeetCode but failing HFT C++ interview rounds on obscure language trivia. Reality check/advice from C++ HFT/Quant devs needed.

Passing LeetCode but failing HFT C++ interview rounds on obscure language trivia. Reality check/advice from C++ HFT/Quant devs needed.

Hello,

From what I understand there are two types of HFT/quant dev roles, one is python based and more closer to implementing trading strategies and the other is C++ lower level making it as fast as possible. I'm not really a maths guy and I find systems and C++ pretty interesting so I'm leaning towards the latter.

However, I think I'm hitting a wall or a mindset problem. I have interviewed with HFT/quant dev firms like HRT, Flow traders, I can pass the OA leetcode but on the next round the level of C++ they ask in the interview is a bit beyond me, they ask a bit random and obscure questions that I never seen in textbooks or some C++ trivia (questions that make me go where on earth am I supposed to know that stuff). I can't really remember the exact questions but examples are C++ features keywords I've never seen before or like what will C++ compiler do in bizarre edge cases (things I'm pretty sure that are not in textbooks I've read so far)

I know I'm pretty far behind but I wanted a reality check if this is something I have a realistic chance of getting into. I'm willing to work hard etc but I just don't have the perspective of the other side so after multiple rejections I've kind of burned out. So hoping for a more senior dev to share their thoughts. If this isn't the right subreddit or the right questions please feel free to correct me, I feel a bit lost honestly.

What I have done:

- 2 years C++11 in a non-trading related company
- 2 years Java in a trading company (regular trading not fancy)
- Can do most Leetcode mediums and some Hard
- Books read from The Definitive C++ Book Guide and List
- C++ Primer, Effective C++, Effective Modern C++, Effective STL, More Effective C++, C++ 17 The Complete Guide
- Books started but incomplete due to burnout
- C++ 20 The Complete Guide, Exceptional C++, C++ Concurrency in Action, A computer arch book (Digital Design and Computer Architecture David Harris).

What I could do (ideas I had):

- Continue studying the The Definitive C++ Book Guide and List
- Do projects like kernel bypassing, ring buffer and add to git.
- Study Computer Architecture book since I'm quite weak in it
- Make my own api for trading
- Read the green book (?) but I thought thats more for quants

Problem is, with the amount of free time I have, it will take me a loong time to finish these projects (1-2 years). And my biggest worry is that even if I finish them, I'll just be asked a really random C++ question that catches me off guard, but maybe I am jumping into worst case scenarios.

I'm honestly even considering to quit my job to focus self-studying full time as I have saved up enough but it requires some mental preparation as unemployment can also be stressful. But some recruiters said my current job is not helping me if I wanted to pursue this so I might as well quit to prepare better.

Any advice on what to do going forward would be really appreciated thank you.

Edit:
Since some concrete examples were requested I have tried to recall them as best I could, but since it was a long time ago it won't be 100%. Q what the interviewer said is what I remember and A is the response I gave.

Maybe my answers are really bad, but if I really have a blindspot any advice is appreciated.

Q: Is there a negative 0 in cpp
A: No (I wasn't sure because I knew there was a signed bit so there could be potentially +/- 0, but I thought that was odd and assumed the compiler will take care of that to avoid side effects and set it to +0 for consistency)
Q: No there is a negative 0

Q: some question if there is single producer and multiple consumer, or multiple producer and single consumer, how will this work (I don't remember)
A: I said something like 1 producer N consumer, can write to a buffer and the N consumers will take turns reading it. N producers 1 consumer I just said something like either write to a queue or consumer goes round robin.
Q: just got irritated with me (I guess I missed something basic?)

Q: Whats the point of memory alignment
A: for quicker retrivial and the archtecture is designed to handle 64bits at a time so if you are forced to use smaller sizes that will add extra processing so they will pad it.
Q: (didn't seem satisfied, maybe I missed something, maybe I am really bad at CPU arch)

Q: What are some methods to avoid using a mutex since its slow
A: Could use read-compare-write (something like used in OS)
Q: hmm, not really

Q: Is mutex handled application level or kernel or where?
A: (Ok I knew there was a mutex c++ library, but there was also a mutex in the OS/Hardware level so I wasn't sure which one so I just said OS/Hardware)
Q: No...

Q: How is the hash function for unordered_map implemented in C++
A: I... don't know, some % modulus maybe. (I never thought about looking it up, is this common knowledge? And where do I learn this? I can't even google this or I'm googling wrong)

Q: producer A consumer B, use memory barrier or atomic and where and why?

Q: what type does tie(A,B) return?

u/HelpfulBuilder6964 — 6 days ago