Tip 1: Study memory alignment, data locality, and the cost of dynamic dispatch. Be prepared to explain why a std::vector of structs is often superior to a std::vector of pointers in terms of CPU cache utilization.
Tip 2: Practice implementing various data structures like Vector, Order Book, Unordered Map, and LRU Cache.
Tip 3: Practice coding questions daily for the OA round.
Tip 1: Showcase low-level mastery. Don’t just list “C++”; highlight projects where you managed memory manually, used multithreading, or optimized code for performance.
Tip 2: Quantify your impact. Instead of saying “Optimized a system,” say “Reduced latency by 15% by implementing a lock-free queue.” HFT firms value candidates who think in terms of microseconds and resource efficiency.
The test was conducted during the daytime and included three easy DSA questions.



For a given string “BaaB”
3 possible palindrome partitioning of the given string are:
{“B”, “a”, “a”, “B”}
{“B”, “aa”, “B”}
{“BaaB”}
Every substring of all the above partitions of “BaaB” is a palindrome.
Count Character Pairs: Count the frequencies of all characters in the array. Since a palindrome is built using pairs of identical characters (with at most one middle character), count how many pairs you have in total and how many “leftover” odd characters remain.
Sort by Length: Sort the original string lengths in ascending order. It is always more efficient to complete a short palindrome first because it requires fewer character pairs, leaving more resources to try and complete longer strings.
Greedy Allocation: Iterate through the sorted lengths. For each string of length L, you need ⌊L/2⌋ pairs to fill it. If you have enough pairs, subtract them and increment your count. Don’t worry about the middle character for odd-length strings; the leftover characters from Step 1 will naturally fill those spots.


Input: [1,2,3,4,5]
Output: [5,4,3,2,1]

Bit-by-Bit Evaluation (LSB to MSB): Since the sum S is fixed, the total contribution of all ai⊕x must equal S. Iterate through bits from k=0 to 61. At each step k, the k-th bit of the sum is determined by the k-th bits of the modified elements (ai⊕x) and the carry from the (k−1) position.
Greedy Choice with Carry Management: For each bit k, you have two choices: set the k-th bit of x to 0 or 1.
If you set xk=0, the k-th bit of the i-th term is ai,k.
If you set xk=1, the k-th bit of the i-th term is 1−ai,k.
Calculate how many 1s are contributed to the k-th position for both choices. Choose the value for xk that results in a k-th bit of the total sum that matches Sk (the k-th bit of S).
Recursive Backtracking (or DP): Because a choice at bit k affects the carry to bit k+1, a pure greedy approach might fail. You must use a recursive function solve(bit, carry) to explore whether a valid x exists. Since the carry can be large, you must observe that the carry eventually stabilizes or can be capped, allowing for a memoized search.


An array 'C' is a subarray of array 'D' if it can be obtained by deletion of several elements(possibly zero) from the beginning and the end of array 'D'. For example, all the non-empty subarrays of array [1,2,3] are [1], [2], [3], [1,2], [2,3], [1,2,3].
Input: 'N' = 3 , 'ARR' = [-5, 10 , 0]
Output: -5
Explanation : The non empty subarrays possible for 'ARR' are [-5], [10], [0], [-5, 10], [-5, 0], [10, 0], [-5, 10, 0]. The sum of the elements of these subarrays are -5, 10, 0, 5, -5, 10, 5. The minimum of them is -5.
Identify the Greedy Choice: To minimize the total sum, each operation should provide the maximum possible reduction. The reduction gained by dividing x is x−⌈x/2⌉=⌊x/2⌋. This reduction is always non-decreasing with respect to x, meaning you should always pick the largest current element in the array for each of the k operations.
Use a Max-Heap (Priority Queue): Repeatedly finding the maximum in a raw array would take O(n) per operation, leading to O(nk), which is too slow. Instead, push all elements into a Max-Priority Queue. This allows you to extract the maximum and re-insert the halved value in O(logn) time.
Iterate and Re-sum: Perform the operation exactly k times (or until the maximum element becomes 0). In each iteration:
Extract the top element max_val.
Calculate new_val = ceil(max_val / 2.0).
Push new_val back into the heap.
After k operations, the sum of all elements currently in the heap is your answer.
It was an afternoon interview. Conducted on the HackerRank platform.
This round involved extensive questions on OS, OOP, and implementation.
They aimed to assess core concepts. They also helped during the implementation part, and writing in a pseudocode manner was acceptable to them.
Tip 1: Read the OSTEP book for OS
Tip 2: Study the Multithreading in Action (C++) book for multithreading
They also asked me to implement a thread pool in C++ using mutexes, semaphores, threads, and a queue.
Tip 1: Practice implementing std::vector, thread pool, memory pool, or have a rough idea of them.
They also asked me to implement a String class (copy constructor/assignment and move constructor/assignment).
Tip 1: Practice implementing std::vector, thread pool, and memory pool, or have a rough idea of them.
It was similar to the previous interview and was conducted on the HackerRank platform. This round was slightly shorter and easier.
This round focused on C++ and implementation.
Tip 1: Again, read any C++ book to understand the underlying concepts of how memory interacts with C++.
It was in the evening and conducted on a video call.
Tip 1: Practice some basic HR questions from the internet.
Tip 2: Be confident.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which data structure is used to implement a DFS?