Given an array of meeting time intervals consisting of start and end times [ [ s1, e1], [ s2, e2], …] ( si < ei ), determine if a person could attend all meetings.
Example 1:
Input: [[0,20],[5,10],[20,30]]
Output: false
Example 2:
Input: [[4,6],[7,10]
Output: true
def Meetings(intvals): intvals.sort() temp=0 for i in range(len(intvals)): if temp < intvals[i][0] : if intvals[i][0] > intvals[i][1] : return False else: temp=intvals[i][1] else: return False return True Time_inter = input('Time intervals : ') import ast #Abstract Syntax Tree Module Time_inter = ast.literal_eval(Time_inter) #Conversion of string to list print(Meetings(Time_inter))
Input_1:
Time intervals : [ [0,20], [5,10], [20,30] ]
Output:
False
Input_2:
Time intervals : [ [4,6], [7,10] ]
Output:
True
Input_3:
Time intervals : [ [1,2], [3,4], [6,10], [7,20] ]
Output:
False
Input_4:
Time intervals : [ [1,2], [3,4], [6,10], [11,20] ]
Output:
True
ILLUSTRATION
More Q
- Determine if a person could attend all meetings in given interval times.
- Find the volume of a volley ball
- Find the maximum score obtained at the end of colour chess grid game.
- Find the number of pairs if positive integers with condition is even.
- Return the largest subset such that every pair meets the given condition.
- Find the number of index triplets that satisfy given condition.
- Handling multiple queries using array – sum, update, range.
- Find all the sequences that occur more than once in DNA molecule.
- Find the biggest number.
- Sum of cube of each number is again equal to the number then it is an Armstrong number.
- Hello World.
- Calculate the Cube Root.
- Find the count of consecutive 1’s present in array.
- Return an array with athletes relative ranks according to the score.
- Return a string of its base 7 representation.
- Return kth largest element in sorted order.
- Reorder array such that arr[0] <= arr[1] >= arr[2] ….arr[n].
- Find all repeated elements in the array.
- Find atleast one duplicate number in the array.
- Find the maximum result of = a XOR b.