## Check if any two intervals overlap among a given set of intervals

OR

Find the maximum number of people were present in a party on single time

OR

Find the maximum number of people were alive at one time

OR

Find the maximum number of meetings active at one time

OR

Find the maximum number of time overlaps.

OR

Find the minimum number of platforms required to accomodate all the trains, trains' schedule is given. You will find the maximum number of overlaps & that number of platforms will be required now.

For all these answers, we can apply the same approach, but keep in mind that we can only get such count not more than that.

To get more information, regarding the meetings, people or time schedules, you need to create a separate class to denote these events & tweak the below approach a bit.

Test Data used :

But for now I am giving the solution to get the count or is there any overlapping only, please let me know if it is failing for any scenario or provide the correct solution or better one, which can be helpful to me & others -

To get more information, regarding the meetings, people or time schedules, you need to create a separate class to denote these events & tweak the below approach a bit.

Test Data used :

*int arrl[] = {1, 2, 8, 5, 5};*

int exit[] = {4, 6, 12, 7, 12};

System.out.println(findMaxOverlap(arrl, exit)); //3

int[][] intervals = {{1, 3}, {5, 7}, {2, 4}, {6, 8}}; //true

// int[][] intervals = {{1, 3}, {7, 9}, {4, 6}, {10, 13}}; //false

System.out.println(isOverlap(intervals));int exit[] = {4, 6, 12, 7, 12};

System.out.println(findMaxOverlap(arrl, exit)); //3

int[][] intervals = {{1, 3}, {5, 7}, {2, 4}, {6, 8}}; //true

// int[][] intervals = {{1, 3}, {7, 9}, {4, 6}, {10, 13}}; //false

System.out.println(isOverlap(intervals));

But for now I am giving the solution to get the count or is there any overlapping only, please let me know if it is failing for any scenario or provide the correct solution or better one, which can be helpful to me & others -

Now, if you have got the time in AM or PM & you also want to find the overlapping schedules/meetings then first convert AM/PM to 24 hour time & create the below kind of class. If you have time as HH:MM:Sec, then convert that time in single number of hours or minutes or seconds.Then follow the above kind of logic to find the overlapping meetings -

Note :- You have to make the necessary changes as per your requirements but apprach can remain same.

Note :- You have to make the necessary changes as per your requirements but apprach can remain same.

## Find the substring in string of 1's & 0's, so that if you flip all the bits of that substring then you should have maximum number of 1's in the String.

Like if you get String as "101010", thhen you will return the start & end index of that substring, so ans can be 1_1, start & end index are separated by '_'

for string "1111", there is no such substring.

for string "111001100100", ans will be 7_11

For the above question, there is constraint of continuous 1's or 0's, you just need to find the substring, so that if you flip its digits then can get the maximum number of 1's in the given string. Below is that approach & same approach can be used to find the maximum sum of subsequence in other kind of problems -