Skip to content

Instantly share code, notes, and snippets.

@goish135
Created August 29, 2021 19:18
Show Gist options
  • Save goish135/66eb795ef1821cc8824c0404f6ea656b to your computer and use it in GitHub Desktop.
Save goish135/66eb795ef1821cc8824c0404f6ea656b to your computer and use it in GitHub Desktop.
class Solution:
def solve(self, times):
times.sort(key=lambda x: x[1])
print(times)
counter = 0
end = -1
for i in range(len(times)):
print("start:",times[i][0])
print("dy. end:",end)
if times[i][0] >= end:
counter += 1
end = times[i][1]
return counter
ob = Solution()
'''
times = [
[3, 6],
[6, 9],
[7, 8],
[9, 11]
]
'''
#times =[[1, 2], [1, 3], [2, 3], [3, 4]] # test case
times =[[3, 4],[1, 2], [1, 3], [2, 3]]
print(ob.solve(times))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment