ARISTA NETWORKS SUMMER INTERN | Coding challenge | Interview experience | August 2024 | [Offer]
Round 1: Coding Challenge
Questions:
-
Given two singly linked-lists A and B and also two integers x and y where x < y <= length(A), insert B between x and y nodes here x and y are indices of nodes in A (1-based).
- Test case:
A = [1,2,3,4,5,6] B = [7,8,9] x = 2, y = 4
- OUTPUT:
A = [1,7,8,9,5,6]
- --> Managed to pass all test cases.
-
This question was a bit lengthy paragraph question but was similar to binary searching on answers: Minimum Number of Days to Make M Bouquets
- --> Was familiar with the approach, so managed to pass all test cases.
-
Given an array A, count the number of pairs
i, j (i < j)
such that ifx = A[i]
andy = A[j]
, they satisfy the following conditions:min(|x - y|, |x + y|) <= min(|x|, |y|)
max(|x - y|, |x + y|) >= max(|x|, |y|)
- Solution: Tried first using brute force --> 9 test cases passed. Then tried to partition based on some logic to get the answers for fixed values and managed to get 11 cases passed but was out of time as I had solved MCQs in between.
Candidate's Approach
- For the first question, implemented a function to traverse the linked list and insert the second list at the specified indices.
- For the second question, applied binary search techniques to find the minimum number of days required.
- For the third question, initially used a brute force method to count pairs, then optimized the solution by partitioning the array based on conditions.
Interviewer's Feedback
No feedback provided.
Round 2: Technical Round 1
Questions:
- Given a singly linked list, swap nodes in pairs.
- Given a BST and integer K, return a pointer to the node which has the minimum absolute difference with K.
- Was able to solve both questions and clearly explained all the questions that were asked.
Candidate's Approach
- For the first question, implemented a function to swap nodes in pairs by adjusting pointers.
- For the second question, traversed the BST to find the node with the minimum absolute difference with K.
Interviewer's Feedback
No feedback provided.
Round 3: Technical Round 2
Questions:
- Focused on OOPs and resume-related questions, particularly about a web development project involving JavaScript, NodeJS, and PostgreSQL.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.