Arista Networks | 6 yrs experience
- Experience
- 6 years
- Posted
- 20 Apr 2023
Summary
I had an interview at Arista Networks for a role that involved two rounds, covering data structures & algorithms, low-level design, and system design, leveraging my 6 years of experience.
How it went
I went through two interview rounds at Arista Networks.
Round 1 focused on data structures and algorithms. I was given two coding problems to solve. The first was a known problem about counting numbers smaller than the current number in an array, and the second was a tree traversal problem to identify 'special' nodes based on their path from the root.
Round 2 covered design concepts. It started with a Low-Level Design (LLD) discussion where I had to detail the design of classes, interfaces, attributes, and methods, with a specific constraint of not using databases or complex data structures. I also delved into UI aspects, including API design, data models, method invocations, and how data structures would be manipulated in response to API calls. Following this, I tackled a System Design problem: designing a URL shortener with features like custom URLs, auto-generated URLs, full CRUD functionality, hit frequency statistics, and an auto-cleanup mechanism for unused URLs.
Questions asked (4)
- 01
Numbers Smaller Than Current
Data Structures & Algorithms · Medium
Given an array
nums, for eachnums[i]find out how many numbers in the array are smaller than it. That is, for eachnums[i]you have to count the number of validj's such thatj != iandnums[j] < nums[i].
Input:[8,1,2,2,3]
Output:[4,0,1,1,3] - 02
Count Special Nodes in Tree
Data Structures & Algorithms · Medium
A node X is said to be special if in the path from root to X there are no nodes with a value greater than X. Return the number of valid special nodes in the tree.
Example:
Valid nodes: 4 (3, 4, 5, 3).3 / \ 1 4 / /
3 1 5 - 03
Low-Level Design Discussion
System Design
I was asked to discuss Low-Level Design principles. This included detailing the design of classes, interfaces, attributes, and methods, with the constraint of not using databases or advanced data structures. Additionally, I needed to explain UI interaction, covering what kind of APIs, data models, and methods APIs would invoke, and how data structures would be manipulated upon API calls.
- 04
Design a URL Shortener
System Design · Hard
I was asked to design a URL shortener system. The requirements included:
- Support for custom user-defined short URLs (e.g.,
www.google.com/news/date/123/xcxcxcxcmapping totiny/news). - Support for auto-generated short URLs (e.g.,
www.dfssssmapping tomy/ab123). - Description of how to implement add, update, and delete functionality.
- Tracking statistics, specifically the frequency of how many times a URL was hit.
- An auto-cleanup mechanism for unused URLs.
- Support for custom user-defined short URLs (e.g.,