Create a component that takes a hardcoded array of intervals and merges any overlapping intervals.
HardProblem Statement
Create a component that takes a hardcoded array of intervals and merges any overlapping intervals.
Sample Input
[[1, 3], [2, 6], [8, 10], [15, 18]]
Sample Output
Merged Intervals: [[1, 6], [8, 10], [15, 18]]
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React from "react";
const MergeIntervals = () => {
return (
<div>
{/* Display merged intervals */}
</div>
);
};
export default MergeIntervals;
Input
[[1, 3], [2, 6], [8, 10], [15, 18]]
Expected Output
Merged Intervals: [[1, 6], [8, 10], [15, 18]]