LinkedIn software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
` 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: Listsignal of 0s and 1s representing antenna readings logged in sequence, where 1 means good signal and 0 means...Input: Array"teamId action timestamp", where action is...Input: Graph (nodes and edges)BuildPipeline class:...Input: Graph (nodes and edges)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)locations representing the...Input: Array of integersA and B. Each value in the catalog represents a product size. Find a pair [a, b] where a...Input: Arrayk substitution operations on a number string s. In each operation, choose any digit in s that is...Input: StringMaxStack() — Construct an empty stack.push(value: int) -> None — Push an entry onto the top.pop() -> int — Remove and return the top entry.top() -> int — Return the top entry without removing it.peekMax() -> int — Return the largest value without removing an entry.popMax() -> int — Remove and return the largest value, breaking ties in favor of the entry closest to the top.{"operations":["MaxStack","push","push","push","top","popMax","top","peekMax","pop","top"],"arguments":[[],[5],[1],[5],[],[],[],[],[],[]]}Output:[null,null,null,null,5,5,1,5,1,5]Explanation: After the three pushes, the stack is
[5, 1, 5] from bottom to top. popMax() removes the topmost 5, leaving [5, 1]. The maximum is still 5, while the top is 1. Popping 1 leaves [5].Example 2:Input:{"operations":["MaxStack","push","push","push","popMax","top","peekMax","popMax","top","pop"],"arguments":[[],[-2],[-5],[-2],[],[],[],[],[],[]]}Output:[null,null,null,null,-2,-5,-2,-2,-5,-5]Explanation: The initial stack is
[-2, -5, -2]. The first popMax() removes the most recently pushed -2. The second removes the older -2 from below -5, leaving [-5]. Negative values use ordinary integer ordering.Constraints:100000 method calls occur after construction.[-1000000000, 1000000000].pop, top, peekMax, and popMax are called only when the stack is nonempty.O(1) or O(log(n + 1)) worst-case time under the standard RAM model; auxiliary space must be O(n).peekMin() -> int and popMin() -> int, also with worst-case O(log(n + 1)) time. For duplicate minimum values, popMin must remove the entry closest to the top. Explain why simply taking the smallest key in a tree ordered by (value, insertion_id) would not implement this tie-break correctly.def shortest_path(graph: Dict[str, List[str]], start: str, target: str) -> List[str]:graph = {'A': ['B', 'C'], 'B': ['A', 'D'], 'C': ['A'], 'D': ['B']}, start = 'A', target = 'D' ['A', 'B', 'D'] graph = {'A': ['B', 'C'], 'B': ['A'], 'C': ['A'], 'D': []}, start = 'A', target = 'D' [] s, write a function that checks if s is a valid palindrome. A valid palindrome reads the same backward as forward after converting all uppercase letters to lowercase and excluding all non-alphanumeric characters.def isPalindrome(s: str) -> bool:"A man, a plan, a canal: Panama" True amanaplanacanalpanama, which is a palindrome."race a car" False 0 <= s.length <= 2 * 10^5 s consists of printable ASCII characters.nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. You must solve this problem in O(n) time complexity. def max_subarray_sum(nums: List[int]) -> int: nums = [-2,1,-3,4,-1,2,1,-5,4] 6 [4,-1,2,1] has the largest sum = 6. nums = [1] 1 1, so the largest sum is 1. 1 <= nums.length <= 10^5 -10^4 <= nums[i] <= 10^4 s, your task is to determine if it is a valid palindrome, considering only alphanumeric characters and ignoring cases. A valid palindrome reads the same forward and backward when ignoring non-alphanumeric characters.def is_valid_palindrome(s: str) -> bool:1 <= len(s) <= 2 * 10^5s, your task is to determine if it is a palindrome considering only alphanumeric characters (a-z, A-Z, 0-9) and ignoring cases. You may assume the input string only contains printable ASCII characters.Function/class signature:def is_palindrome(s: str) -> bool:"A man, a plan, a canal: Panama"True"race a car"False0 <= s.length <= 2 * 10^5s consists of printable ASCII characters.s is a valid palindrome, considering only alphanumeric characters and ignoring case. Return true if it is a palindrome, otherwise return false.def is_palindrome(s: str) -> bool:"A man, a plan, a canal: Panama" True amanaplanacanalpanama, which reads the same backward."race a car" False raceacar, which does not form a palindrome.1 <= len(s) <= 2 * 10^5 s, return true if it is a palindrome, considering only alphanumeric characters and ignoring case. A palindrome reads the same backward as forward.Function/class signature:def is_palindrome(s: str) -> bool:"A man, a plan, a canal: Panama" true amanaplanacanalpanama which is the same forwards and backwards."race a car" false raceacar which is not the same backward.0 <= s.length <= 2 * 10^5 s consists of printable ASCII characters.n representing the number of profiles and a list of connections edges, return the connected components across profiles.int n, edges defined as a list of pairs representing connections.List[List[int]] — a list that contains all connected components, with each component being a list of profile IDs.0 <= n <= 20000 <= edges.length <= n * (n - 1) / 2string s, return the length of the longest substring without repeating characters.string s int — length of the longest substring without repeating characters.0 <= s.length <= 5 * 10^4s consists of English letters, digits, symbols, and spaces.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free