Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def findMinRooms(*lists):
- L, i = [], 0
- while i <len(lists):
- L.append(lists[i])
- i+=1
- L.sort()
- i, count, c2, itr = 1, 1, 0, L[0]
- while i < len(L):
- if (itr == L[i]):
- itr = L[i]
- count +=1
- elif (itr[1] <= L[i][0]):
- itr = L[i]
- c2, count = max(c2,count), 1
- else:
- count+=1
- i+=1
- return max(c2,count)
- print("l = actual: 1. from function =", findMinRooms([1,3]))
- print("l1 = actual: 3. from function =", findMinRooms([3.1, 8.0], [2.3, 5.0], [1.2, 3.4]))
- print("l2 = actual: 2. from function =", findMinRooms([4.1, 8.0], [2.3, 5.0], [1.2, 3.4]))
- print("l3 = actual: 4. from function =", findMinRooms([3.1, 8.0], [2.3, 5.0], [1.2, 3.4], [1.0, 10.0]))
- print("l4 = actual: 3. from function =", findMinRooms([1.1, 1.5], [5, 6], [4, 7], [1.0, 2.0], [3, 8]))
- print("l6 = actual: 4. from function =", findMinRooms([1,2],[1,22],[1.5,6], [6,10],[6,10],[6,10], [12.1,17.8]))
- print("l7 = actual: 1. from function =", findMinRooms([1,2],[2,3],[3,4],[15,18]))
- print("l8 = actual: 3. from function =", findMinRooms([1,3],[1,3],[1,3]))
- print(findMinRooms([1,20],[2,19],[3,15],[16,18],[17,20])) #output should be 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement