Nutanix | MTS-3 | REJECTED | NOVEMBER 2024
Company: Nutanix
Role: MTS-3
Interview Stage: Onsite
Location: unknown
Year: 2024
Original Post Content:
1. DSA ROUND 1
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root.
The path sum of a path is the sum of the node's values in the path.
Given the root of a binary tree, return the maximum path sum of any non-empty path.
- extra question as time was there (no judgement on this question)
You are provided a completely disconnected graph of N nodes i.e. none of the nodes are connected to each other. Each node has a value A[i] associated with it.
You are provided with M operations: Add an edge between 2 nodes, u and v.
Post this operation, there will be some connected components in the graph. The value of the connected component is the sum of the value of all nodes in the component.
After every operation, print the maximum value of any component in the graph.
Constraints:
The number of nodes in the graph [1, 10^5].
1 <= Node.val <= 10^5
The number of operations [1, 10^5]
2. DSA ROUND 2
Given a string S consisting of lowercase alphabets, the task is to find the lexicographically smallest string that can be obtained by removing duplicates from the given string S.
Examples:
Input: S = "yzxyz"
Output: xyz
Explanation: Removing the duplicate characters at indices 0 and 1 in the given string, the remaining string "xyz" consists only of unique alphabets only and is the smallest possible string in lexicographical order.
- extra question as time was there (no judgement on this question)
You have a list of N integer locations of balls A = [x1 , x2 , x3 , ....... , xN ] in the x-axis, where A[i] = integer location i-th ball occupies .
In one operation, you can move a ball if and only if it is at an endpoint position to a position which is not an endpoint position. For example, if balls are at positions x, y, z with x<y<z, then you can move ball at position x to position k such that y<k<z or you can move ball at position z to position k such that x<k<y.
x y z
4 8 11
Determine the minimum number of operations to move all the balls to N consecutive locations.
Input Format :
The first line of input contains N (3<= N <= 105) . Each of the next N lines contain the integer location of a single ball in the range (1<= xi <=109)
Output Format :
Minimum number of moves you need to make to group the balls together.
Sample Input:
3
7
4
9
Sample Output:
1
Explanation:
The minimum number of moves is 1 --- if we move the ball in position 4 to position 8, then the balls are at consecutive locations 7, 8, 9
VERDICT - SELECTED FOR NEXT 2 DESIGN ROUND as I answered all the questions.
3. DESIGN ROUND 1
HLD-pubsub model like kafka (draw.io link shared to demonstrate your architecture)
Round goes well, SPOFs were asked and scalability with distributed systems also.
4. DESIGN ROUND 2
LLD-Problem Statement
Design a tracing library and service. The primary purpose of this is to debug live systems when there are problems. You can assume the data from this is output to a HTTP server with some basic GUI, that the developer connects to when he is interested to debug.
Tracing
Is the process of recording information about how a software program executes. This information is used to debug, diagnose problems, and optimize performance.
Here are some characteristics of tracing:
Continuous view: Tracing provides a continuous view of an application, while logging provides a more discrete view.
Focus on optimization: Tracing is used to identify bottlenecks and improve performance.
Provides specific information: Tracing provides more specific information about the execution path of individual requests.
Records a user's journey: Tracing can represent a single user's journey through an entire app stack.
Records time and other attributes: Tracing records the time it takes for each service and subcomponents within service to respond to a request.
Uses unique identifiers: Each piece of data that travels together has a unique identifier.
Task:
Design a library that can be used by multiple services to record traces
Design a trace backend service and APIs
That can register traces from clients
That can fetch the complete traces for user requests
Should be reliable and persistent (agree on a degree)
Should be low over-head for consumer services
Bonus
Scalable
I was not sure about my solution about this LLD question, but did these my approach interviewer was not friendly :-
Trace 1 (User Request 1)
- Span 1 <- Backend Service 1
- Span 2 <- Backend Service 2
- Span 3 <- Backend Service 3
Trace
-id
-List<Spans>
Span
-id // backend service name
-double TAT
-List<MethodCalls>
MethodCalls
-id // method name
-String Filename
-int line
-status
-double TAT // 200, 400
@PostMapping
createTrace(Trace trace)
@GetMapping("/api/traces/{id}")
getTrace(@PathVariable)
@GetMapping("/api/traces?status=\"404\"")
getAllTraces()
@GetMapping
getMostDelayedRequests('/api/traces?time='20s'')
Map<String,Trace> traceMap = new HashMap<>();
/key-tracedid
public List<Traces> getMostDelayed
-----
client/Server Side DB
Span-DB
-id
-trace_id
-method<call>
Trace 2 (User Request 2)
- Span 1 <- Backend Service 1
- Span 2 <- Backend Service 2
- Span 3 <- Backend Service 3
Overall the last LLD round did not go so well.
VERDICT - REJECTED
HOPE YOU FIND THIS INFORMATIVE.
STILL LOOKING FOR JOB SWITCH. WISH ME LUCK.
Please let me know if you have solution for bonus question in second round.