There is one meeting room in a firm. There are N meetings in the form of (start[i], end[i]) where start[i] is start time of meeting i and end[i] is finish time of meeting i.
What is the maximum number of meetings that can be accommodated in the meeting room when only one meeting can be held in the meeting room at a particular time? 
Note: Start time of one chosen meeting can't be equal to the end time of the other chosen meeting.
Example 1:
Input:
N = 6
start[] = {1,3,0,5,8,5}
end[] =  {2,4,6,7,9,9}
Output: 
4
Explanation:
Maximum four meetings can be held with
given start and end timings.
The meetings are - (1, 2),(3, 4), (5,7) and (8,9)
Example 2:
Input:
N = 3
start[] = {10, 12, 20}
end[] = {20, 25, 30}
Output: 
1
Explanation:
Only one meetings can be held
with given start and end timings.
Your Task :
You don't need to read inputs or print anything. Complete the function maxMeetings() that takes two arrays start[] and end[] along with their size N as input parameters and returns the maximum number of meetings that can be held in the meeting room.
Expected Time Complexity : O(N*LogN)
Expected Auxilliary Space : O(N)
Constraints:
1 ≤ N ≤ 10^{5}
0 ≤ start[i] < end[i] ≤ 10^{5}

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms
Expected Time Complexity: O(N*LogN)
Expected Auxiliary Space: O(N)

Starter code:
#User function Template for python3



class Solution:

    

    #Function to find the maximum number of meetings that can

    #be performed in a meeting room.

    def maximumMeetings(self,n,start,end):

        # code here

Solutions:
class Solution:

	def maximumMeetings(self, n, start, end):
		meets = list(zip(start, end))
		meets.sort(key=lambda x: x[1])
		ans = 0
		last = float('-inf')
		for i in range(n):
			if meets[i][0] > last:
				ans += 1
				last = meets[i][1]
		return ans


import heapq

class Solution:

	def maximumMeetings(self, n, start, end):
		if len(start) == 0:
			return 0
		(end, start) = zip(*sorted(zip(end, start)))
		answer = 1
		heap = []
		heapq.heappush(heap, end[0])
		for i in range(len(end)):
			if start[i] > heap[0]:
				heapq.heappop(heap)
				answer = answer + 1
				heapq.heappush(heap, end[i])
		return answer


class Solution:

	def maximumMeetings(self, n, start, end):
		lst = []
		for i in range(n):
			lst.append((end[i], start[i]))
		lst.sort()
		count = 0
		t = -1
		for node in lst:
			s = node[1]
			e = node[0]
			if s > t:
				count += 1
				t = e
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		x = []
		for i in range(0, len(start)):
			k = [start[i], end[i]]
			x.append(k)
		x.sort(key=lambda x: x[1])
		c = 1
		et = x[0][1]
		for i in range(1, len(x)):
			if x[i][0] > et:
				c += 1
				et = x[i][1]
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		meeting_timestamps = []
		for i in range(n):
			meeting_timestamps.append((start[i], end[i]))
		meeting_timestamps.sort(key=lambda x: x[1])
		(res, end_time) = (1, meeting_timestamps[0][1])
		for i in range(n):
			if meeting_timestamps[i][0] > end_time:
				res += 1
				end_time = meeting_timestamps[i][1]
		return res


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = [(end[i], start[i]) for i in range(n)]
		arr.sort()
		(end, start) = (list(), list())
		for (endTime, startTime) in arr:
			end.append(endTime)
			start.append(startTime)
		count = 0
		currEndTime = 0
		for i in range(n):
			if end[i] > currEndTime and start[i] > currEndTime:
				count += 1
				currEndTime = end[i]
		return count


class Solution:

	def maximumMeetings(self, N, start, end):
		pairs = [(a, b) for (a, b) in zip(start, end)]
		sorted_pairs = sorted(pairs, key=lambda x: x[1])
		start_sorted = [x[0] for x in sorted_pairs]
		end_sorted = [x[1] for x in sorted_pairs]
		count = 1
		j = 0
		for i in range(1, N):
			if start_sorted[i] > end_sorted[j]:
				count += 1
				j = i
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		m = []
		for i in range(n):
			m.append((start[i], end[i]))
		m.sort(key=lambda x: x[1])
		l = 0
		c = 0
		for i in range(n):
			if m[i][0] > l:
				l = m[i][1]
				c = c + 1
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		meet = []
		for i in range(n):
			meet.append((start[i], end[i]))
		meet.sort(key=lambda a: a[1])
		limit = meet[0][1]
		s = 1
		for i in range(n):
			if meet[i][0] > limit:
				limit = meet[i][1]
				s += 1
		return s


class Solution:

	def maximumMeetings(self, n, start, end):
		sortedList = []
		for i in range(n):
			sortedList.append([start[i], end[i]])
		sortedList.sort(key=lambda i: i[1])
		count = 1
		limit = sortedList[0][1]
		for i in range(1, n):
			if sortedList[i][0] > limit:
				count += 1
				limit = sortedList[i][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, ends):
		if n == 1:
			return 1
		(ends, start) = zip(*sorted(zip(ends, start)))
		(start, ends) = (list(start), list(ends))
		mr = 1
		end_prev = ends[0]
		for i in range(1, len(start)):
			if start[i] > end_prev:
				mr += 1
				end_prev = ends[i]
		return mr


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(n):
			arr.append([start[i], end[i]])
		arr.sort(key=lambda x: x[1])
		ans = 1
		m_end = arr[0][1]
		for i in range(n):
			m_start = arr[i][0]
			if m_start > m_end:
				ans += 1
				m_end = arr[i][1]
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		meet = []
		for i in range(n):
			meet.append([start[i], end[i]])
		meet.sort(key=lambda x: x[1])
		res = 1
		last = meet[0][1]
		for i in range(1, n):
			if meet[i][0] > last:
				last = meet[i][1]
				res += 1
		return res


class Solution:

	def maximumMeetings(self, n, start, end):
		ar = []
		for i in range(n):
			ar.append((start[i], end[i]))
		ar.sort()
		ar.sort(key=lambda x: x[1])
		prev = ar[0][1]
		ans = 1
		for i in range(1, n):
			if ar[i][0] > prev:
				ans += 1
				prev = ar[i][1]
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		intervals = []
		for (start, end) in zip(start, end):
			intervals.append([start, end])
		intervals.sort(key=lambda x: x[1])
		last = intervals[0][1]
		count = 1
		for (start, end) in intervals[1:]:
			if start > last:
				count += 1
				last = end
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(n):
			arr.append([start[i], end[i]])
		pair = sorted(arr, key=lambda x: x[1])
		count = 1
		curr = pair[0][1]
		for i in range(1, n):
			if pair[i][0] > curr:
				count += 1
				curr = pair[i][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):

		def myFunc(e):
			return e[1]
		count = 0
		endval = 0
		tuples = []
		for i in range(n):
			tuples.append([start[i], end[i]])
		tuples.sort(key=myFunc)
		for i in range(n):
			if i == 0:
				endval = tuples[i][1]
				count += 1
			elif tuples[i][0] > endval:
				endval = tuples[i][1]
				count += 1
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		l = []
		for i in range(0, len(start)):
			l.append([start[i], end[i], i])
		l.sort(key=lambda x: x[1])
		cnt = 1
		i = 1
		tmp = l[0]
		while i <= len(l) - 1:
			if l[i][0] > tmp[1]:
				cnt += 1
				tmp = l[i]
				i += 1
			else:
				i += 1
		return cnt


class Solution:

	def maximumMeetings(self, n, start, end):
		aux = [[0 for _ in range(3)] for _ in range(n)]
		for i in range(n):
			aux[i][0] = i + 1
			aux[i][1] = start[i]
			aux[i][2] = end[i]
		aux.sort(key=lambda x: x[2])
		result = [aux[0]]
		prev = aux[0]
		for i in range(1, n):
			if aux[i][1] > prev[2]:
				result.append(aux[i])
				prev = aux[i]
		return len(result)


class Solution:

	def maximumMeetings(self, n, start, end):
		list1 = []
		for i in range(0, n):
			list2 = [start[i], end[i]]
			list1.append(list2)
		list1.sort(key=lambda x: x[1])
		ans = 1
		x = 0
		for i in range(1, n):
			if list1[i][0] > list1[x][1]:
				ans += 1
				x = i
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		vp = [(start[i], end[i]) for i in range(n)]
		vp.sort(key=lambda a: a[1])
		ct = 1
		endmeet = vp[0][1]
		for i in range(1, n):
			if vp[i][0] > endmeet:
				ct = ct + 1
				endmeet = vp[i][1]
		return ct


class Solution:

	def maximumMeetings(self, n, start, end):
		meeting = [(start[i], end[i]) for i in range(n)]
		meeting.sort(key=lambda a: a[1])
		count = 1
		ansEnd = meeting[0][1]
		for i in range(1, n):
			if meeting[i][0] > ansEnd:
				count += 1
				ansEnd = meeting[i][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(n):
			arr.append([start[i], end[i]])
		arr.sort(key=lambda x: x[1])
		x = 1
		end = arr[0][1]
		for i in range(1, n):
			start = arr[i][0]
			if end < start:
				x += 1
				end = arr[i][1]
			else:
				pass
		return x


class Solution:

	def maximumMeetings(self, n, start, end):
		meeting_lis = []
		for i in range(len(start)):
			meeting_lis.append([start[i], end[i]])
		meeting_lis.sort(key=lambda x: x[1])
		ini = meeting_lis[0]
		count = 1
		for i in range(1, len(meeting_lis)):
			if meeting_lis[i][0] > ini[1]:
				count += 1
				ini = meeting_lis[i]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):

		def sort(start, end):
			l = []
			for (i, j) in zip(start, end):
				l.append([i, j])
			l = sorted(l, key=lambda x: x[1])
			return l
		res = sort(start, end)
		prev = res[0][1]
		c = 1
		for i in range(1, n):
			if prev < res[i][0]:
				prev = res[i][1]
				c += 1
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		l = list(zip(start, end))
		l = sorted(l, key=lambda x: x[1])
		res = 1
		earliest_end = l[0][1]
		for i in range(1, n):
			if l[i][0] > earliest_end:
				res += 1
				earliest_end = l[i][1]
		return res


class Solution:

	def maximumMeetings(self, n, start, end):
		time = [[start[i], end[i]] for i in range(len(end))]
		time.sort(key=lambda x: x[1])
		(count, finish) = (0, -1)
		for i in time:
			if finish < i[0]:
				finish = i[1]
				count += 1
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		m = []
		for i in range(len(start)):
			m.append([start[i], end[i]])
		m.sort(key=lambda m: m[1])
		res = 1
		e = m[0][1]
		for i in range(1, len(m)):
			if m[i][0] > e:
				res += 1
				e = m[i][1]
		return res


class Solution:

	def maximumMeetings(self, n, start, end):
		meetings = [[start_t, end_t] for (start_t, end_t) in zip(start, end)]
		meetings.sort()
		meetings.append([float('inf'), float('inf')])
		prev_end_time = float('inf')
		res = 0
		for meeting in meetings:
			(curr_start_time, curr_end_time) = (meeting[0], meeting[1])
			if prev_end_time >= curr_start_time:
				prev_end_time = min(prev_end_time, curr_end_time)
			else:
				res += 1
				prev_end_time = curr_end_time
		return res


class Solution:

	def maximumMeetings(self, n, start, end):
		ans = []
		x = [[start[i], end[i], i + 1] for i in range(n)]
		x = sorted(x, key=lambda x: (x[1], x[2]))
		limit = x[0][1]
		ans.append(x[0][2])
		for i in range(1, n):
			if x[i][0] > limit:
				limit = x[i][1]
				ans.append(x[i][2])
		return len(ans)


class Solution:

	def maximumMeetings(self, n, start, end):
		meetings = list(zip(start, end))
		meetings.sort(key=lambda x: x[1])
		last_end = 0
		count = 0
		for meeting in meetings:
			(start, end) = meeting
			if start > last_end:
				count += 1
				last_end = end
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		l = []
		for i in range(n):
			l.append([end[i], start[i]])
		l.sort()
		en = l[0][0]
		st = l[0][1]
		cnt = 0
		ans = 1
		for i in range(1, n):
			if en < l[i][1]:
				en = l[i][0]
				ans += 1
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):

		def maxMeetings(s, e):
			l = list(zip(s, e))
			l.sort(key=lambda x: x[1])
			last_time = float('-inf')
			count = 0
			for (i, j) in l:
				if i > last_time:
					count += 1
					last_time = j
			return count
		return maxMeetings(start, end)


class Solution:

	def maximumMeetings(self, n, start, end):
		meetings = [(start[i], end[i]) for i in range(len(end))]
		meetings.sort(key=lambda x: x[1])
		ans = 1
		prev = 0
		for i in range(len(end)):
			if meetings[prev][1] < meetings[i][0]:
				prev = i
				ans += 1
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		ar = [[start[i], end[i]] for i in range(n)]
		ar.sort(key=lambda x: x[1])
		cur = 1
		now = ar[0][1]
		ps = ar[0][0]
		for i in ar[1:]:
			if i[0] > now:
				now = i[1]
				cur += 1
		return cur


class Solution:

	def maximumMeetings(self, n, start, end):
		newlst = []
		for i in range(len(start)):
			newlst.append((start[i], end[i]))
		newlst = sorted(newlst, key=lambda i: i[1])
		count = 1
		start = newlst[0][0]
		end = newlst[0][1]
		for i in range(1, n):
			if newlst[i][0] > end:
				count += 1
				end = newlst[i][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		count = 1
		l = sorted(zip(end, start))
		limit = l[0][0]
		for x in range(1, n):
			if l[x][1] > limit:
				count += 1
				limit = l[x][0]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		m = [[i, j] for (i, j) in zip(start, end)]
		m.sort(key=lambda x: x[-1])
		k = [m[0]]
		for i in m[1:]:
			if k and k[-1][1] < i[0]:
				k.append(i)
		return len(k)


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(0, n):
			arr.append([start[i], end[i]])
		arr.sort()
		cnt = 0
		i = 0
		j = 0
		while i < len(arr) and j < len(arr):
			en = arr[i][1]
			j = i + 1
			while j < len(arr) and arr[j][0] <= en:
				cnt += 1
				en = min(en, arr[j][1])
				j += 1
			i = j
		return n - cnt


class Solution:

	def maximumMeetings(self, n, start, end):
		c = 0
		l = []
		last_successful_endtime = 0
		for i in range(n):
			l.append([start[i], end[i], i])
		l = sorted(l, key=lambda x: x[1])
		for ll in l:
			if (ll[0] < ll[1]) & (ll[0] > last_successful_endtime):
				c += 1
				last_successful_endtime = ll[1]
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		l = []
		for i in range(len(start)):
			l.append([start[i], end[i]])
		l.sort(key=lambda x: x[1])
		res = []
		res.append(l[0])
		c = 1
		for (s, e) in l[1:]:
			if s > res[-1][1]:
				res.append([s, e])
				c += 1
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		pairs = []
		for i in range(n):
			s = start[i]
			e = end[i]
			pairs.append([s, e])
		pairs = sorted(pairs, key=lambda pair: pair[0])
		count = 1
		s = pairs[0][0]
		e = pairs[0][1]
		for pair in pairs:
			if pair[0] >= s and pair[0] <= e:
				if pair[1] <= e:
					s = pair[0]
					e = pair[1]
				else:
					pass
			else:
				count += 1
				s = pair[0]
				e = pair[1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		li = []
		for (i, j) in zip(start, end):
			li.append((i, j))
		li.sort(key=lambda x: x[1])
		prev = -1
		count = 0
		for i in li:
			if i[0] < i[1] and i[0] > prev:
				count += 1
				prev = i[1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		jobs = []
		ans = 0
		for i in range(n):
			jobs.append([start[i], end[i], i])
		jobs.sort(key=lambda x: x[1])
		curr_job = jobs[0]
		ans += 1
		for i in range(1, n):
			if curr_job[1] < jobs[i][0]:
				ans += 1
				curr_job = jobs[i]
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		temp = []
		for i in range(n):
			temp.append((start[i], end[i]))
		temp.sort(key=lambda l: l[1])
		start = []
		end = []
		for i in range(n):
			start.append(temp[i][0])
			end.append(temp[i][1])
		cnt = 1
		END = end[0]
		for j in range(1, n):
			if start[j] > END:
				cnt = cnt + 1
				END = end[j]
		return cnt


class Solution:

	def maximumMeetings(self, n, start, end):
		l = []
		lis = []
		for i in range(n):
			l = [start[i], end[i]]
			lis.append(l)
		f = sorted(lis, key=lambda x: x[1])
		i = 0
		c = 1
		for j in range(1, n):
			if f[j][0] > f[i][1]:
				c += 1
				i = j
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		a = [[start[i], end[i]] for i in range(n)]
		a.sort(key=lambda x: x[1])
		k = 0
		ans = 0
		for r in a:
			if r[0] > k:
				ans += 1
				k = r[1]
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(n):
			arr.append([end[i], start[i]])
		arr.sort()
		c = 1
		limit = arr[0][0]
		for i in range(1, n):
			if arr[i][1] > limit:
				c += 1
				limit = arr[i][0]
		return c


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for (i, j) in zip(start, end):
			arr.append([j, i])
		arr.sort()
		count = 1
		start_ind = 1
		end_ind = 0
		prev = arr[0]
		for i in range(1, n):
			if arr[i][start_ind] > prev[end_ind]:
				count += 1
				prev = arr[i]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		lt = []
		ans = 0
		for i in range(n):
			lt.append([start[i], end[i], i])
		lt.sort(key=lambda x: x[1])
		ans += 1
		time_end = lt[0][1]
		for i in range(1, n):
			if time_end < lt[i][0]:
				ans += 1
				time_end = lt[i][1]
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		timing = []
		for i in range(n):
			timing.append((start[i], end[i]))
		sorted_val = sorted(timing, key=lambda x: x[1])
		count_ = 1
		(i, j) = (0, 1)
		while j <= n - 1:
			if sorted_val[i][1] < sorted_val[j][0]:
				count_ += 1
				i = j
			j += 1
		return count_


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		count = 1
		for i in range(n):
			arr.append((start[i], end[i]))
		arr_sorted = sorted(arr, key=lambda x: x[1])
		starting = arr_sorted[0][0]
		ending = arr_sorted[0][1]
		for i in range(1, n):
			if arr_sorted[i][0] > ending:
				count += 1
				ending = arr_sorted[i][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(n):
			arr.append([start[i], end[i]])
		arr.sort(key=lambda x: x[1])
		count = 1
		c = 0
		for i in range(1, n):
			if arr[i][0] > arr[c][1]:
				count += 1
				c = i
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		lis = []
		for i in range(0, n):
			lis.append([start[i], end[i], i + 1])
		lis.sort(key=lambda x: x[1])
		e = lis[0][1]
		op = 1
		for i in range(1, n):
			if lis[i][0] > e:
				op = op + 1
				e = lis[i][1]
		return op


class Solution:

	def maximumMeetings(self, n, start, end):
		meetings = [(start[i], end[i]) for i in range(n)]
		meetings.sort(key=lambda x: x[1])
		cnt = 1
		end_time = meetings[0][1]
		for i in range(1, n):
			if meetings[i][0] > end_time:
				cnt += 1
				end_time = meetings[i][1]
		return cnt


class Solution:

	def maximumMeetings(self, n, start, end):
		interval = list(zip(start, end))
		interval.sort()
		(l, r) = interval[0]
		count = 1
		for i in range(1, n):
			(l2, r2) = interval[i]
			if l2 <= r:
				r = min(r, r2)
			else:
				count += 1
				r = r2
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		act = zip(start, end)
		act_sor = sorted(act, key=lambda task: task[1])
		co = 1
		l = len(act_sor)
		ls = act_sor[0][1]
		for i in range(1, l):
			if act_sor[i][0] > ls:
				co += 1
				ls = act_sor[i][1]
		return co


class Solution:

	def maximumMeetings(self, n, start, end):
		activity = []
		for i in range(n):
			activity.append((start[i], end[i]))
		activity = sorted(activity, key=lambda item: item[1])
		finish_time = activity[0][1]
		cnt = 1
		for i in range(1, n):
			if activity[i][0] > finish_time:
				cnt += 1
				finish_time = activity[i][1]
		return cnt


class Solution:

	def maximumMeetings(self, n, start, end):
		arr = []
		for i in range(n):
			arr.append((start[i], end[i]))
		arr.sort(key=lambda a: a[1])
		count = 1
		if arr == None:
			return 0
		curr = arr[0]
		for i in range(1, n):
			if arr[i][0] > curr[1]:
				curr = arr[i]
				count += 1
		return count


from functools import cmp_to_key

class Solution:

	def compare(self, a, b):
		if a[0][1] != b[0][1]:
			return a[0][1] - b[0][1]
		return a[1] - b[1]

	def maximumMeetings(self, n, start, end):
		x = []
		for i in range(n):
			x.append([[start[i], end[i]], i + 1])
		x = sorted(x, key=cmp_to_key(self.compare))
		last = -1
		count = 0
		for i in range(n):
			if x[i][0][0] > last:
				count += 1
				last = x[i][0][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		p = []
		for i in range(n):
			p.append([start[i], end[i]])
		p.sort(key=lambda x: x[1])
		count = 1
		en = p[0][1]
		i = 1
		while i < len(p):
			if p[i][0] > en:
				count += 1
				en = p[i][1]
			i += 1
		return count


class Solution:

	def maximumMeetings(self, n, s, e):
		meetings = []
		for i in range(n):
			meetings.append({'start': s[i], 'end': e[i], 'pos': i + 1})
		meetings.sort(key=lambda meeting: meeting['end'])
		answer = []
		limit = meetings[0]['end']
		answer.append(meetings[0]['pos'])
		for i in range(1, n):
			if meetings[i]['start'] > limit:
				limit = meetings[i]['end']
				answer.append(meetings[i]['pos'])
		return len(answer)


class Solution:

	def maximumMeetings(self, n, start, end):
		time = []
		for i in range(len(start)):
			time.append([start[i], end[i], i + 1])
		time.sort(key=lambda x: x[1])
		cur_end = -1
		ans = []
		for i in range(len(time)):
			if cur_end < time[i][0]:
				cur_end = time[i][1]
				ans.append(time[i][2])
		return len(ans)


class Solution:

	def maximumMeetings(self, n, start, end):
		meetings = sorted(zip(start, end), key=lambda x: x[1])
		count = 1
		prev_end = meetings[0][1]
		for i in range(1, n):
			if meetings[i][0] > prev_end:
				count += 1
				prev_end = meetings[i][1]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		points = []
		for i in range(n):
			points.append([start[i], end[i]])
		points.sort(key=lambda x: x[1])
		count = 1
		i = 0
		current_end = points[0][1]
		while i < n - 1:
			if current_end >= points[i + 1][0]:
				i += 1
			else:
				count += 1
				current_end = points[i + 1][1]
				i += 1
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		lst = []
		for i in range(n):
			lst.append((start[i], end[i]))
		lst.sort(key=lambda x: (x[1], x[0]))
		end = -1
		ct = 0
		for i in range(n):
			if lst[i][0] > end:
				ct += 1
				end = lst[i][1]
		return ct


class meeting:

	def __init__(self, start, end, pos):
		self.start = start
		self.end = end
		self.pos = pos

class Solution:

	def maximumMeetings(self, n, start, end):
		meet = [meeting(start[i], end[i], i + 1) for i in range(len(start))]
		meet.sort(key=lambda x: (x.end, x.pos))
		limit = meet[0].end
		positions = [1]
		for i in range(1, n):
			if limit < meet[i].start:
				limit = meet[i].end
				positions.append(meet[i].pos)
		return len(positions)


class Solution:

	def maximumMeetings(self, n, start, end):

		def create_tuple(n, start, end):
			l = []
			for i in range(n):
				l.append((start[i], end[i]))
			l = sorted(l, key=lambda x: x[1])
			return l
		t = create_tuple(n, start, end)
		l = []
		l.append(t[0])
		for i in range(1, n):
			if t[i][0] > l[-1][1]:
				l.append(t[i])
		return len(l)


class Solution:

	def maximumMeetings(self, n, start, end):
		(ss, se) = zip(*sorted(zip(start, end), key=lambda x: x[1]))
		count = 1
		end = se[0]
		for i in range(1, len(ss)):
			if ss[i] > end:
				count += 1
				end = se[i]
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		meet = [(start[i], end[i], i + 1) for i in range(n)]
		meet = sorted(meet, key=lambda x: (x[1], x[2]))
		limit = meet[0][1]
		_res = 1
		for i in range(1, n):
			if meet[i][0] > limit:
				limit = meet[i][1]
				_res += 1
		return _res


class Solution:

	def maximumMeetings(self, n, start, end):
		meetings = [(start[i], end[i]) for i in range(len(start))]
		meetings.sort(key=lambda x: x[1])
		maxMeetings = 0
		lastEnd = 0
		for meeting in meetings:
			if meeting[0] > lastEnd:
				maxMeetings += 1
				lastEnd = meeting[1]
		return maxMeetings


class Solution:

	def maximumMeetings(self, n, start, end):
		data = [[a, b] for (a, b) in zip(start, end)]
		data.sort(key=lambda x: x[1])
		res = [data[0]]
		for i in range(1, len(data)):
			if data[i][0] > res[-1][1]:
				res.append(data[i])
		return len(res)


class Solution:

	def maximumMeetings(self, n, st, end):
		arr = []
		for i in range(len(st)):
			arr.append([st[i], end[i]])
		arr = sorted(arr, key=lambda x: x[1])
		count = 1
		ansEnd = arr[0][1]
		for i in range(1, len(arr)):
			if arr[i][0] > ansEnd:
				ansEnd = arr[i][1]
				count += 1
		return count


class Solution:

	def maximumMeetings(self, n, start, end):
		temp = []
		for i in range(n):
			temp.append([start[i], end[i]])
		temp.sort(key=lambda x: x[1])
		ans = 1
		endtime = temp[0][1]
		for i in range(1, n):
			if temp[i][0] > endtime:
				ans += 1
				endtime = temp[i][1]
		return ans


class Meeting:

	def __init__(self, start, end, idx):
		self.start = start
		self.end = end
		self.index = idx

	def __repr__(self):
		return '(' + str(self.start) + ',' + str(self.end) + ')'

class Solution:

	def maximumMeetings(self, n, start, end):
		meeting_list = []
		for i in range(n):
			s = start[i]
			e = end[i]
			meeting_obj = Meeting(s, e, i)
			meeting_list.append(meeting_obj)
		meeting_list.sort(key=lambda x: (x.end, x.index))
		ans = []
		first_meet = meeting_list[0]
		ans.append(first_meet)
		end_time = first_meet.end
		for idx in range(1, n):
			if meeting_list[idx].start > end_time:
				ans.append(meeting_list[idx])
				end_time = meeting_list[idx].end
		return len(ans)


class NewDataStructure:

	def __init__(self, start, end, pos):
		self.start = start
		self.end = end
		self.pos = pos

class Solution:

	def maximumMeetings(self, n, start, end):
		final_list = []
		for i in range(len(start)):
			make_pair = NewDataStructure(start[i], end[i], i + 1)
			final_list.append(make_pair)
		final_list.sort(key=lambda x: x.end)
		my_dict = {}
		ans = 1
		time = final_list[0].end
		for i in range(1, len(final_list)):
			if final_list[i].start > time:
				ans += 1
				time = final_list[i].end
		return ans


class Solution:

	def maximumMeetings(self, n, start, end):
		lst = []
		for i in range(n):
			lst.append((start[i], end[i]))
		meetings = sorted(lst, key=lambda x: x[1])
		count = 0
		(i, j) = (0, 1)
		while j < len(meetings):
			if meetings[i][1] < meetings[j][0]:
				count += 1
				i = j
			j += 1
		return count + 1