Tower Research Capital LLC
40+ Haeal Pharma Interview Questions and Answers
You are given an array/list 'prices' where the elements of the array represent the prices of the stock as they were yesterday and indices of the array represent minutes. Your task...read more
You are given an arbitrary binary tree, a node of the tree, and an integer 'K'. You need to find all such nodes which have a distance K from the given node and return ...read more
Q3. A group of n people is such that a symmetric relation of knowing another exists in the group. i.e. the relation is A knows B. and being symmetric if A knows B then B knows A. Prove that there exist atleast 2 pe...
read moreIn a group of people with a symmetric relation of knowing each other, there will always be at least two people who know the same number of people.
Consider the person who knows the maximum number of people in the group.
If there is no one who knows the same number of people, then everyone else must know a different number of people.
But this would mean that the total number of people known by everyone else is different from the total number of people known by the person who know...read more
Ninja has recently joined a dance studio as a coach. In the studio, there are N boys and M girls. He can make K potential pairs out of them. He needs to find the maximum number of pairs he can mak...read more
The city of Ninjaland is analogous to the unweighted graph. The city has ‘N’ houses numbered from 1 to ‘N’ respectively and are connected by M bidirectional roads. If a road ...read more
You are given two strings BEGIN and END and an array of strings DICT. Your task is to find the length of the shortest transformation sequence from BEGIN to END such that in every transformation you c...read more
Q7. Consider the set S of the first 2n numbers, then show that for any subset of size n+1 of the set S, there exists 2 numbers u and v such that u divides v
For any subset of size n+1 of the set S of the first 2n numbers, there exists 2 numbers u and v such that u divides v.
Divide the set S into two subsets of n numbers each.
By the pigeonhole principle, at least one of the subsets contains two numbers whose ratio is an integer.
If the subset contains n+1 numbers, then one of the numbers must be in the subset with the two numbers whose ratio is an integer.
Therefore, there exists 2 numbers u and v such that u divides v.
You are given an array 'ARR' consisting of 'N' positive integers, and you need to reduce the size of the array to 1 by performing an operation several number of times. In a single ...read more
Q9. There were 7 guests at a party + a host. 1st guest shook hands with 1 guy, 2nd guest with 2 guys .... kth guest with k guys. How many people did the host shake hands with? k was either 6 or 7, probably 7 – I do...
read moreAt a party with 7 guests and a host, each guest shakes hands with a certain number of people. How many people did the host shake hands with?
The first guest shakes hands with 1 person, the second with 2 people, and so on.
The kth guest shakes hands with k people.
The host shakes hands with all 7 guests, so the number of people the host shakes hands with is the sum of 1 to 7.
The sum of 1 to n is n(n+1)/2, so the host shakes hands with 28 people.
Ninja lives in a beautiful city known as Byteland. A grand festive event is going to be organised in the city. To make place for the event, King has ordered Ninja to clear the nearby forest. ...read more
Q11. In a city represented as a 2-D plane there are buildings at different positions. The position of the buildings(x,y co-ordinates) and their heights are given. Write an efficient algorithm to determine the buildi...
read moreAlgorithm to determine visible buildings in a 2D plane with given positions and heights
Sort the buildings by their x-coordinates
Traverse the sorted buildings from left to right
For each building, check if it is visible by comparing its height with the maximum height of previously visited buildings
If visible, add it to the list of visible buildings
Return the list of visible buildings
You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.
A cell is said to be connected to...read more
You are given an arbitrary binary tree consisting of N nodes, where each node is associated with a certain value, and two node values, a and b, you need to check if these nodes ar...read more
You are given the root of a complete binary tree, you need to calculate the number of nodes in the given complete binary tree.
A complete binary tree is a tree in which all the leve...read more
You are given a string ‘S’. Your task is to return all distinct palindromic substrings of the given string in alphabetical order.
A string is said to be palindrome if the reverse of the st...read more
You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:
You are given an array consisting of 0s and 1s. You need to find the length of the largest subarray with an equal number of 0s and 1s.
For example:
If the given ar...read more
You are given an array(ARR) of length 'N', consisting of non-negative integers. Using only these given numbers, rearrange the numbers in such a way that th...read more
Q19. Given an undirected graph, if dist(u,v)>n/2. Show that there exists a vertex x such that removing x makes u and v go to different connected components.
If dist(u,v)>n/2 in an undirected graph, there exists a vertex x such that removing x makes u and v go to different connected components.
Find the shortest path between u and v
If the path length is greater than n/2, then there must be a vertex x on the path
Removing x will separate u and v into different connected components
Q20. Given a string, find the largest substring which can be formed from repetition (>=2) of the smaller string
Find the largest substring formed from repetition of a smaller string.
Identify all possible substrings of the given string.
Check if each substring can be formed by repeating a smaller string.
Return the largest substring that can be formed from repetition of a smaller string.
You are given a map of an island. Your task is to find the perimeter of the island. The map is represented by a binary grid where ‘0’ represents water, and ‘1’ represents the land.
Note:
There...read more
Q22. Show that for a grid of size n*n, if n is odd then there cannot be a Hamiltonian cycle in the graph
For an odd-sized grid, there cannot be a Hamiltonian cycle in the graph.
A Hamiltonian cycle is a path that visits every vertex exactly once and ends at the starting vertex.
In an n*n grid, there are n^2 vertices and each vertex has degree 4.
For an odd n, the total degree of all vertices is odd, which means there cannot be a Hamiltonian cycle.
Q23. Prove that F_nk is divisible by F_n where F_i is the ith Fibonacci number. with f_0 = 0
Prove that F_nk is divisible by F_n where F_i is the ith Fibonacci number. with f_0 = 0
Use mathematical induction to prove the statement
Base case: F_n0 = 0, F_n is also 0, so 0 is divisible by 0
Inductive step: Assume F_nk is divisible by F_n, prove F_n(k+1) is divisible by F_n
F_n(k+1) = F_nk + F_n(k-1), use the assumption to show that F_nk is divisible by F_n
Therefore, F_n(k+1) is also divisible by F_n
Hence, the statement is true for all k
Q24. In a 2 D plane, every point is assigned a color either blue or red. Prove that there exists a rectangle with all corners of the same color
Prove that there exists a rectangle with all corners of the same color in a 2D plane with blue and red points.
Divide the plane into a grid of squares.
By the pigeonhole principle, there must be at least one row or column with four points of the same color.
Consider the pairs of points in that row or column and check if any of them form a rectangle.
Q25. The Red-Blue Hat Prisoners puzzle: if prisoner guesses colour of his hat he lives else dies. Idea is to save as many prisoners as possible. Actual solution saves n-1 prisoners but I hadn’t heard this puzzle bef...
read moreSolution to Red-Blue Hat Prisoners puzzle that saves n - log(n) prisoners.
Red-Blue Hat Prisoners puzzle involves prisoners guessing the color of their own hat to save their lives.
The actual solution saves n-1 prisoners, but there are alternative solutions that can save more prisoners.
One such solution involves using binary encoding to communicate the color of the hats, which can save n - log(n) prisoners.
This solution works by having each prisoner encode the color of their ha...read more
Q26. Given a unit circle with center at origin, I choose three points on the circle. Find the expected length of the segment containing (1.0). Hint: answer is not 2*pi/3
Expected length of segment containing (1,0) on a unit circle with three random points.
Use law of cosines to find length of each segment.
Calculate expected value using probability density function.
Answer is (4/pi) + (2/3).
You have to create a landing page, where you will provide linkages. On click of linkages button, the respective page should open below. Give different approaches.
So we can do it using fram...read more
What is TLB? Why is it used? What are huge pages and their advantages? Which is accessed first TLB or cache? Can we access TLB and cache in parallel?
How are system calls made at assembly leve...read more
Q29. Given k and DFS traversal string for a k-ary tree, construct the tree. The String contains P (if a parent) and L (if a leaf). E.g. - k=3, str="PPLLLLL" 2. All the strings are arranged in the following order: A,...
read moreThe question asks to construct a k-ary tree using the given k and DFS traversal string.
Iterate through the DFS traversal string
If the current character is 'P', create a parent node
If the current character is 'L', create a leaf node
Link the nodes according to the DFS traversal order
Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than $2000 per month who have been employees for less than months. Sor...read more
Asked about the system architecture i was working on. And then went deeper to ask other related stuffs. And also there were some situational questions like what would you do if you get into s...read more
Given that an API service is responding slower than usual, what steps will you take to figure out the problem?
Q34. "How would you tell whether a graph has a node with n degree?"
To determine if a graph has a node with n degree, iterate through all nodes and count their edges.
Iterate through each node in the graph
Count the number of edges connected to each node
If any node has n edges, then the graph has a node with n degree
Interviewer asked me to explain the ACID properties and explain the rollback mechanism in DBMS.
Describe classes and functions for the design of Splitwise.
So there was employee table and department table and you have to output max earning person from each department.
Given a Problem Statement and a Code we need to find the bug in the code and correct the given code.
Q39. Would you prefer to develop mathematical models or to develop the trading infrastructure?
I would prefer to develop mathematical models.
I enjoy the process of creating and testing mathematical models.
Developing trading infrastructure is important, but not my primary interest.
Mathematical models can be applied to various industries, not just trading.
Examples of mathematical models I have developed include predictive models for customer behavior and financial forecasting models.
Q40. Check if a string containing parenthesis is balanced
Check if a string containing parenthesis is balanced
Use a stack to keep track of opening parenthesis
Iterate through the string and push opening parenthesis onto the stack
If a closing parenthesis is encountered, check if the stack is empty or if the top of the stack is the corresponding opening parenthesis
If the stack is empty or the top of the stack doesn't match, the string is not balanced
After iterating through the string, if the stack is empty, the string is balanced
Q41. Check if a graph has a unique Topological sort
A graph has a unique topological sort if and only if it is a directed acyclic graph (DAG).
A topological sort is a linear ordering of the vertices of a graph such that for every directed edge (u, v), vertex u comes before vertex v in the ordering.
To check if a graph has a unique topological sort, we can use depth-first search (DFS) or breadth-first search (BFS) algorithms.
If during the DFS or BFS traversal, we encounter a back edge or a cycle, then the graph does not have a un...read more
Multiprocessing vs multithreading
Q43. Explaining incidents faced
I have faced incidents related to system crashes, network failures, and security breaches.
System crash due to hardware failure
Network failure due to misconfiguration
Security breach due to weak password policy
DDoS attack causing website downtime
Q44. Design MakeMyTrip kind of application.
MakeMyTrip is a travel booking application that allows users to book flights, hotels, and holiday packages.
Include features like flight/hotel search, booking, payment gateway integration, and user profiles.
Implement filters for search results, reviews/ratings for hotels, and notifications for booking updates.
Integrate maps for location tracking, weather forecasts, and customer support chatbot.
Offer discounts, loyalty programs, and referral bonuses to attract and retain custom...read more
More about working at Tower Research Capital LLC
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month