Level: Junior-Level
Round: Online Assessment · Type: Coding · Difficulty: 6/10 · Duration: 60 min · Interviewer: Unfriendly
Topics: Arrays, Intervals, Graph Theory, Connectivity, Union Find
Location: San Francisco Bay Area
Interview date: 2025-09-21
I completed an online assessment with two questions on HackerRank.
The online assessment consisted of two coding problems:
Problem Description: Given a set of logs, each containing a start and end time (both inclusive), representing the active period of a process. Find the maximum number of processes running concurrently at any given time.
Input: A 2D array where each element is [start, end], representing a process's active interval. Output: An integer representing the maximum number of concurrent processes.
Examples:
[[1, 3], [2, 4], [3, 6]]
[[2, 6], [1, 2], [3, 5]]
Problem Description:
You manage link_nodes code repositories, numbered from 1 to link_nodes. Some repositories are already synchronized through bidirectional links. Repositories A and B are considered synchronized if they are connected directly or indirectly.
You can redistribute existing links by deleting a link and connecting it between any two repositories. The goal is to make all repositories belong to the same synchronized system.
Input:
link_nodes: The number of nodes.link_from[]: An array of link start points.link_to[]: An array of link end points.Output: An integer representing the minimum number of links that need to be redistributed. Return -1 if it's impossible to connect all repositories.
Critical Condition:
link_nodes - 1, it's impossible to connect all nodes → Output -1.Examples:
link_nodes = 4link_from = [1, 1, 3]link_to = [2, 3, 2]link_nodes = 4link_from = [1, 2]link_to = [3, 4]