Question bank › Binary Search Tree
Dsa Binary Search Tree Hard

Merge Duplicated Ranges

Given a list of integer ranges (represented by pairs of start and end) where some ranges may overlap, create a binary search tree to merge overlapping ranges. The input format consists of the first line containing an integer n (the number of ranges), followed by n lines, each containing two integers, start and end. Print the merged ranges in sorted order. Each range should be represented by the format '[start, end]'. If two ranges overlap, merge them into one. Example input/output can be seen below. Input: 5 1 3 2 6 8 10 15 18 17 20 Output: [1, 6] [8, 10] [15, 20]

Key concepts

binary_search_treerangemergededuplication

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.