CodeLab Academy 📞 9936 6696
← List Python · Level 10: Algorithms Code · 100 points ← #936 #938 →

#937. Activity selection

You get the start and end times of n activities. Choose the largest number of activities that do not overlap (one may start at the moment another ends). Print that number. ### Input n, then n lines `s e`. ### Output A number.

Examples

Input
5
12 15
11 13
19 20
16 20
13 16
Output
3
Input
5
17 21
11 17
12 16
14 17
12 17
Output
2

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!