This is a verified interview question from Bny. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Question 3" covers key patterns like Arrays.
"In a scheduling system, there are n events represented by two arrays, start and finish, both of size n. The i-th event begins at start[i] and ends at finish[i] (where 0 <= i < n). A subset of these events is considered high-priority at least one event within it overlaps or intersects with every other event in the subset. Determine the maximum size of a high-priority subset of events. Notes: - Events that overlap at their start and end times are considered to intersect. - There may be multiple events with the same start and end times. Example: - n = 4 - start = [0,2,3,4] - finish = [2,3,5,6] The largest high-priority subset is {2, 3, 5} where event (2, 5) intersects the remaining events in the subset. Function Description: Complete the 'getSubsetLength' function below. The function is expected to return an integer representing the length of the largest high-priority subset of events. Parameters: - n (int): The number of events. - start (List<Integer>): Event start times. - finish (List<Integer>): Event end times."
Join thousands of developers practicing for Bny.