Merge Overlapping Intervals

In merge overlapping intervals problem we have given a collection of intervals, merge and return all overlapping intervals. Example   Input : [[2, 3], [3, 4], [5, 7]] Output: [[2, 4], [5, 7]] Explanation: We can merge [2, 3] and [3, 4] together to form [2, 4] Please click Like if …

Read more

Merge K Sorted Linked Lists

Merge K sorted linked lists problem is so famous as per the interview point of view. This question asks so many times in big companies like Google, Microsoft, Amazon, etc.  As the name suggests we’ve been provided with k sorted linked lists. We have to merge them together into a …

Read more

Max Area of Island

Problem Description: Given a 2D matrix, the matrix has only 0(representing water)  and 1(representing land) as entries. An island in the matrix is formed by grouping all the adjacent 1’s connected 4-directionally(horizontal and vertical). Find the maximum area of the island in the matrix. Assume that all four edges of …

Read more

Merging Intervals

In merging intervals problem we have given a set of intervals of the form [l, r], merge the overlapping intervals. Examples   Input {[1, 3], [2, 6], [8, 10], [15, 18]} Output {[1, 6], [8, 10], [15, 18]} Input {[1, 4], [1, 5]} Output {[1, 5]} Naive Approach for merging intervals   …

Read more

Merge Overlapping Intervals II

Problem Statement   In the “Merge Overlapping Intervals II” problem we have given a set of intervals. Write a program that will merge the overlapping intervals into one and print all the non-overlapping intervals. Input Format   The first line containing an integer n. Second-line containing n pairs where each pair is …

Read more

The Celebrity Problem

Problem Statement   In the celebrity problem there is a room of N people, Find the celebrity. Conditions for Celebrity is- If A is Celebrity then Everyone else in the room should know A. A shouldn’t know anyone in the room. We need to find the person who satisfies these conditions. …

Read more

Ads Blocker Image Powered by Code Help Pro
Ads Blocker Detected!!!

This website does not work properly with AdBlock. We have detected that you are using extensions to block ads. Please disable Adblocker to view the content.