Check if the given playlist of programs is valid

Problem Statement: Given a playlist that contains the list of intervals with the start time, end time and program id. Write a program to validate whether the playlist is valid or not based on certain conditions.  The playlist will be considered invalid if any of the following is true – If any two programs overlap. … Read more Check if the given playlist of programs is valid

Maximum meetings in one room

You have one meeting room at your company. There are N meeting needs to take place. Every meeting has a start time and end time along with the meeting title. Your task is to schedule as many meetings as possible in that conference room with no conflicts.  Example: Meetings: A[ Start Time: 1, End Time: … Read more Maximum meetings in one room

Job Sequencing algorithm – Java

Objective: You are given n jobs along with the deadline and profit for each job. Your task is to write an algorithm to choose the jobs wisely which can maximize the profit. Also compute the maximum profit. Below are the details Each job duration is 1 unit. Name – Name of the job. Deadline – … Read more Job Sequencing algorithm – Java

Find if any two intervals overlap in given intervals

Objective: Interval is defined as [start, end]- the start of an interval to the end of the interval. Given a list of Intervals. Your task is to check if any two intervals overlap. Example: Given Interval: [[1,5], [6,10], [12,15], [3,7]] Two intervals are present which intersect Given Interval: [[1,5], [6,10], [12,15]] No intervals overlasx Approach:  … Read more Find if any two intervals overlap in given intervals

Sum of distinct elements among two given sets

Objective: Given two sets of elements, find the sum of all distinct elements from the set. In other words, find the sum of all elements which are present in either of the given set.  This problem is also asked as – Find sum of non-overlapping numbers in two given sets. Example: Set 1 : [3, … Read more Sum of distinct elements among two given sets

Number of Intervals in which given value lies

Objective: Given a list of intervals with start and end for each interval. You have given a value V, write an algorithm to find the number of intervals in which the value V lies.  Example: Given Interval: [[1,7], [3,10], [12,15]] Value : 6 lies in Intervals: 2 Given Interval: [[1,7], [3,10], [12,15]] Value : 11 … Read more Number of Intervals in which given value lies

Activity Selection Problem

Objective: The activity selection problem is a combinatorial optimization problem concerning the selection of non-conflicting activities to perform within a given time frame, given a set of activities each marked by a start time (si) and finish time (fi). The problem is to select the maximum number of activities that can be performed by a … Read more Activity Selection Problem

Determine the given routing number belong to which bank

Objective: Given the banks and range of routing numbers for each bank. You have given a routing number, write a program to determine which bank it belongs to. Input: Given a list of routing ranges for each bank, with a start number, end number, and bank name. For instance, range = [1001, 1005, BOFA] has … Read more Determine the given routing number belong to which bank

Check if interval is covered in given coordinates

Objective: Given 1-D list of coordinates, (x1, x2), (x3, x4), , , ,(xn-1, xn)and interval (a, b). Write an algorithm to determine if interval (a,b) is covered in the list of coordinates. Example: Coordinates –  [(2,5), (5,7),(1,4)] and interval = (1,6) Return true Explanation – Points 1 to 6 lies in list of interval given … Read more Check if interval is covered in given coordinates