LinkedIn | SWE | Bangalore
Background:
Screening Theoretical Questions:
Screening Coding Question:
Imagine you have a string of letters. You want to divide it into pieces so that each piece contains unique letters (no letter appears in more than one piece). When put together, the pieces should form the original string. Find the max number of pieces possible and their lengths.
Input: s = "ecedfdfaa"
Output: [3, 4, 2]
Explanation: The pieces are "ece", "dfdf", and "aa".
Algorithm:
1Find start and end indices for each character's occurrence in the string.
2Sort: Arrange the characters based on their starting indices.
3Similar to Merge Intervals:
4 Iterate through the sorted characters.
5 Check for overlaps with the previous piece.
6 If no overlap, start a new piece.
7 If overlap, update the current piece's length.
8The final list of lengths represents the desired output.Complexity: O(n log b), where n is the string length and b is the number of unique characters. The same solution can be extended for an O(n + b) solution.
Onsite Coding 1:
Onsite Coding 2:
Concurrency:
Implement a concurrent solution using a producer-consumer pattern with n producers and n consumers in a publisher-subscriber model.
Managerial Round:
Deep dive into past projects.
Problem: Design a monitoring system to check the correctness of output for a system with unknown output behavior.
Solution: Separate inputs into classes and create a time series graph for each class. Track the count of inputs over time and set alerts for deviations exceeding a specific threshold. Other statistics like standard deviation, variance, sum, mode, and mean can also be considered.
System Design:
Design a strongly consistent and scalable aggregation system for data pertaining to last 10 minutes.