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#2
2. 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
codingMediumVerified Question#3
3. 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#4
4. 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
codingMediumVerified Question#5
5. 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#6
6. 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
codingMediumVerified Question#7
7. 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#8
8. 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
codingMediumgraph#1
1. [Graph] — Find the shortest path in a social network
Background: LinkedIn’s social networking platform allows users to connect, and understanding the shortest path of connections between two users can enhance recommendations and search functions. Problem statement: Given a social network represented as an undirected graph, where each node represents a user and each edge represents a connection, write a function to find the shortest path between two users. You need to return a list of users representing the path from the start user to the target user. If no path exists, return an empty list. Function/class signature:
Example 1: Input: graph = {'A': ['B', 'C'], 'B': ['A', 'D'], 'C': ['A'], 'D': ['B']}, start = 'A', target = 'D' Output: ['A', 'B', 'D'] Explanation: The shortest path from A to D is A → B → D. Example 2: Input: graph = {'A': ['B', 'C'], 'B': ['A'], 'C': ['A'], 'D': []}, start = 'A', target = 'D' Output: [] Explanation: There is no connection from A to D. Constraints:
1 <= number of users <= 1000
Each user name is a non-empty string, and there will not be any cycles in the graph.
codingMediumarray#2
2. Maximum Subarray Sum: Finding the contiguous subarray with the largest sum
Background: LinkedIn handles vast amounts of data and user interactions, and analyzing these interactions is vital for understanding user behavior and improving products. The Maximum Subarray Sum problem is essential in optimizing queries and data analysis. Problem statement: Given an integer array 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. Function/class signature:
def max_subarray_sum(nums: List[int]) -> int:
Example 1:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: The contiguous subarray [4,-1,2,1] has the largest sum = 6.
Example 2:
Input: nums = [1]
Output: 1
Explanation: The only element is 1, so the largest sum is 1.
Constraints:
1 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
codingMediumtwo pointers#3
3. Valid Palindrome — Check if a string is a valid palindrome
1. Background: LinkedIn's user experience often involves processing user-generated content. Ensuring that usernames or comments meet certain criteria, like being a valid palindrome, helps maintain brand integrity and enhances user interaction. 2. Problem statement: Given a string 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. 3. Function/class signature: - def is_valid_palindrome(s: str) -> bool: 4. Example 1: - Input: "A man, a plan, a canal: Panama" - Output: True - Explanation: Ignoring spaces and punctuation, reads the same backward. 5. Example 2: - Input: "race a car" - Output: False - Explanation: After cleansing, it does not read the same backward. 6. Constraints: - 1 <= len(s) <= 2 * 10^5 - The input string consists only of printable ASCII characters. 7. Additional Notes: Implement a function that can efficiently check for palindrome nature without extra space, utilizing pointers.
codingMediumtwo pointers#4
4. Valid Palindrome String Problem: Determine if a given string is a palindrome considering only alphanumeric characters.
Background: LinkedIn matches professionals with similar interests, and ensuring data integrity is crucial. Determining if user-generated content, such as bios or posts, maintain certain properties (like palindrome) can enhance user experiences and prompt engagement.Problem statement: Given a string s, 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:
Example 1:
Input: "A man, a plan, a canal: Panama"
Output: True
Explanation: When considering only alphanumeric characters and case insensitivity, the string reads the same backwards as forwards.
Example 2:
Input: "race a car"
Output: False
Explanation: The string contains non-alphanumeric characters and does not read the same backward.
Constraints:
0 <= s.length <= 2 * 10^5
The string s consists of printable ASCII characters.
Note: Use two-pointer technique for efficient checking.
codingMediumtwo pointers#5
5. Two Pointers — Check if a string is a valid palindrome
Background: LinkedIn needs to ensure that user-generated content maintains quality and integrity. A common validation check is to verify if strings are palindromes, which can be relevant for features like username verification or content moderation. Problem statement: Write a function that determines if a given string s is a valid palindrome, considering only alphanumeric characters and ignoring case. Return true if it is a palindrome, otherwise return false. Function/class signature:
def is_palindrome(s: str) -> bool:
Example 1: Input: "A man, a plan, a canal: Panama" Output: True Explanation: The alphanumeric characters are amanaplanacanalpanama, which reads the same backward. Example 2: Input: "race a car" Output: False Explanation: The alphanumeric characters are raceacar, which does not form a palindrome. Constraints:
1 <= len(s) <= 2 * 10^5
The input string consists of printable ASCII characters.
codingMediumstring#6
6. Valid Palindrome — Determine if a string is a palindrome ignoring non-alphanumeric characters and case.
Background: LinkedIn often displays user-generated content, such as posts and comments, where it's important to handle text evaluations accurately for features like content moderation. A valid palindrome check could assist in identifying formatted user inputs.Problem statement: Given a string 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:
Example 1:
Input: "A man, a plan, a canal: Panama"
Output: true
Explanation: When ignoring non-alphanumeric characters and case, it reads amanaplanacanalpanama which is the same forwards and backwards.
Example 2:
Input: "race a car"
Output: false
Explanation: The string ignores the spaces and reads raceacar which is not the same backward.
Constraints:
0 <= s.length <= 2 * 10^5
s consists of printable ASCII characters.
Start practicing LinkedIn questions
Sign up for free to access walkthroughs, AI-generated questions, and more.