Divide Intervals into Minimum Number of Groups | Leetcode 2406 | leetcode daily problem today

preview_player
Показать описание

You are given a 2D integer array intervals where intervals[i] = [lefti, righti] represents the inclusive interval [lefti, righti].

You have to divide the intervals into one or more groups such that each interval is in exactly one group, and no two intervals that are in the same group intersect each other.

Return the minimum number of groups you need to make.

Two intervals intersect if there is at least one common number between them. For example, the intervals [1, 5] and [5, 8] intersect.

I am using counting sort paradigm, creating an count array and at start value index increasing the value in array and end+1 index i am decreasing the value by 1. after this i am traversing from left to right keep on summing the values and recording the max ever recorded value into answer variable and return answer finally.


2406. Divide Intervals Into Minimum Number of Groups
Divide Intervals Into Minimum Number of Groups
2406. Divide Intervals Into Minimum Number of Groups
Divide Intervals Into Minimum Number of Groups

leetcode 2406
leetcode 2406 in java

leetcode daily problem today
leetcode daily problem today

daily leetcode problem today
daily leetcode problem today
daily leetcode problem today

leetcode daily problem today
leetcode daily problem today

daily leetcode problem today
daily leetcode problem today
daily leetcode problem today

today leetcode daily problem
today leetcode daily problem
today leetcode daily problem


DSA Algorithms :-
Design HLD:-

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #india #hindiexplanation #hindiexplained #easyexplaination #interview #interviewtips
#interviewpreparation #interview_ds_algo #hinglish
Рекомендации по теме
Комментарии
Автор

understood the code and also the dry run but still didnt understood why we are doing +1, and -1

tejasdhole