FastPrepFastPrep
Problem Brief

Merge Intervals with Names

ONSITE INTERVIEW

This is like merge interval question but the result needs to have a list of names in the interval too. The OP mentioned that they did not quite sure how the list of names is done...And neither am I..😱

1Example 1

Input
intervals = [["Foo", "10", "30"], ["Bar", "15", "45"]]
Output
["10 15 Foo", "15 30 Foo, Bar", "30 45 Bar"]
Explanation
🐠

Constraints

Limits and guarantees your solution can rely on.

🐳
public String[] mergeIntervalsWithNames(String[][] intervals) {
  // write your code here
}
Input

intervals

[["Foo", "10", "30"], ["Bar", "15", "45"]]

Output

["10 15 Foo", "15 30 Foo", "Bar", "30 45 Bar"]

Sign in to submit your solution.