Category: String coding problemConfiguration files at LinkedIn are written in JSON, YAML, and HOCON formats. Malformed config files can bring down multiple services, so validators...Input: String Output: Printed output
codingMediumVerified Question#2
2. Words From Phone Number
Category: String coding problemA standard phone keypad maps digits to letters as follows: ` 2 -> a, b, c 3 -> d, e, f 4 -> g, h, i 5 -> j, k, l 6 -> m, n, o 7 -> p, q, r, s 8 ->...Input: List Output: Array
codingMediumVerified Question#3
3. Circular Signal Window
Category: Array coding problemYou are given a circular array signal of 0s and 1s representing antenna readings logged in sequence, where 1 means good signal and 0 means...Input: Array Output: Integer
codingEasyVerified Question#4
4. Active Sprint Filter
Category: Graph coding problemA project tracking system logs team activity throughout the workday. Each log entry has the format "teamId action timestamp", where action is...Input: Graph (nodes and edges) Output: Printed output
codingMediumVerified Question#5
5. Dependency Task Executor
Category: Graph coding problemA build system manages pipeline steps where each step may depend on other steps completing first. Implement the BuildPipeline class:...Input: Graph (nodes and edges) Output: Computed result
codingMediumVerified Question#6
6. Daily Branch Pruning
Category: Tree coding problemA file system manages a directory tree. Each day, all leaf directories (those with no child directories) are simultaneously removed. Directories that...Input: Array Output: Array
codingHardVerified Question#7
7. [OA] Minimum Weight Ceiling Path
Category: Graph coding problemA network topology connects n servers labeled 1 to n. Each connection is a bidirectional link with a bandwidth cost. A network engineer needs...Input: Graph (nodes and edges) Output: Integer
codingHardVerified Question#8
8. Priority Cache System
Category: String coding problemA CDN (Content Delivery Network) maintains a fixed-capacity cache of web content. Each content item has an associated priority score. When the cache...Input: String Output: Integer
codingMediumVerified Question#9
9. Distribution Center Placement
Category: Array coding problemA logistics company is expanding its distribution network along a single highway. You are given an array of integers locations representing the...Input: Array of integers Output: Computed result
codingMediumVerified Question#10
10. Manual String Substitution
Category: String coding problemA template engine needs to substitute all occurrences of a pattern in a template string with a replacement string, without using any built-in...Input: String Output: Printed output
codingHardVerified Question#11
11. Combine N-ary Trees
Category: Tree coding problemYou are given the roots of two N-ary organization charts, each representing a hierarchical department structure. Every node has an integer...Input: List Output: Computed result
codingMediumVerified Question#12
12. Closest Value Pair
Category: Array coding problemAn inventory system has two sorted product catalogs A and B. Each value in the catalog represents a product size. Find a pair [a, b] where a...Input: Array Output: Computed result
codingMediumVerified Question#13
13. Digit Replacement Maximizer
Category: String coding problemA numeric optimization system performs exactly k substitution operations on a number string s. In each operation, choose any digit in s that is...Input: String Output: Computed result
codingHardsliding window#1
1. [OA] Sliding Window Maximum — Optimize feed updates in LinkedIn's news feed
To provide an optimized news feed experience, LinkedIn needs to find the maximum engagement scores among k updates shared by users in real-time. Given an array of integers representing engagement scores for the updates, return an array of maximum scores for each sliding window of size k.Function Signature: - function maxSlidingWindow(scores: number[], k: number): number[]Example 1: Input: scores = [1, 3, -1, -3, 5, 3, 6, 7], k = 3 Output: [3, 3, 5, 5, 6, 7] Explanation: The maximum of the first three scores is 3, then 5 for the next window, and so forth.Example 2: Input: scores = [1, -1], k = 1 Output: [1, -1] Explanation: Each element is its own maximum in a window of size 1.Constraints: - 1 <= scores.length <= 10^5 - -10^4 <= scores[i] <= 10^4 - 1 <= k <= scores.length
LinkedIn's frontend applications require efficient data fetching and rendering without blocking the UI thread. Given an array of integers representing taskDurations (in milliseconds) for asynchronous tasks, simulate the behavior of the event loop to determine the total time taken to complete all tasks and print them in the order they finish. You may assume a maximum concurrency of n (number of simultaneous tasks).Function Signature: - function simulateEventLoop(taskDurations: number[], n: number): numberExample 1: Input: taskDurations = [200, 100, 300], n = 2 Output: 400 Explanation: The first two tasks run concurrently (200ms, 100ms), taking 200ms, followed by the 300ms task which starts after the 100ms task completes.Example 2: Input: taskDurations = [300, 100, 200, 400], n = 2 Output: 700 Explanation: The first two tasks (300ms and 100ms) complete in 300ms, followed by 200ms starting, and then 400ms which completes after.Constraints: - 1 <= taskDurations.length <= 1000 - 1 <= taskDurations[i] <= 10^4 - 1 <= n <= 100
system designSeniorapi design#3
3. [OA] Design a Debounced EventEmitter for LinkedIn's Notifications
For LinkedIn's notification system, we need to design a Debounced EventEmitter that prevents rapid firing of events when notifications are updated. The debounce should wait a specified time period before invoking the callback for the latest event.Class Signature: - class DebouncedEventEmitter { - emit(event: string, data: any): void; - on(event: string, callback: Function): void; - constructor(delay: number); - }Example 1: - Initialize an event emitter with a 200ms debounce: const emitter = new DebouncedEventEmitter(200). - Call emitter.on('notify', (data) => console.log(data)); and emitter.emit('notify', 'You have a new message!'), it should log once after 200ms of inactivity.Constraints: - The debounce should correctly handle multiple calls to emit within the specified delay.
system designSeniorapi design#4
4. [OA] Design a Client-Side Router for LinkedIn
With the requirement of an efficient and performant navigation system within LinkedIn's Single Page Application (SPA), design a client-side router that will help manage the navigation state and URL changes without refreshing the entire page.Class Signature: - class Router { - constructor(routes: Map<string, Function>); - navigate(url: string): void; - on(url: string, handler: Function): void; - }Example 1: - Initialize a Router with routes: const router = new Router(new Map([['/', () => 'Home'], ['/profile', () => 'Profile']])) - Call router.navigate('/') should call the handler for home and update the view accordingly.Constraints: - The Router should ensure that handlers for routes are invoked in order and each URL is associated with a specific view. - Only allow paths as keys in the routes Map. - Max 100 routes can be registered at a time.