This question evaluates proficiency in interval scheduling and resource allocation as well as shortest-path computation in weighted directed graphs, emphasizing event ordering, efficient priority structures and graph traversal techniques.
You are asked to solve two algorithmic problems.
You are given an array of meeting time intervals intervals, where each interval is [start, end) with 0 <= start < end.
true
if a single person can attend all meetings (i.e., no overlaps), else
false
.
n
rooms labeled
0..n-1
. Schedule meetings in start-time order using the lowest-index available room; if none are available at a meeting’s start, delay the meeting until the earliest room becomes free (preserving meeting duration). Return the room index that hosted the most meetings (tie → smallest index).
1 <= intervals.length <= 2e5
1e9
Given a weighted directed graph with V nodes labeled 0..V-1 and E edges. Each edge is (u, v, w) with w > 0.
V
, edge list,
source s
,
target t
.
s
to
t
(and optionally the actual path). If
t
is unreachable, return
-1
.
1 <= V <= 2e5
,
0 <= E <= 2e5