A conference app builds a personal schedule. Each talk is [start, end] in minutes from the start of the day. A person can be in only one talk at a time, and must stay from its start to its end. A talk may start at the exact minute another one ends.
Write mostTalks(talks) that returns the largest number of talks one person can attend.
Input: talks = [[1,3],[2,5],[0,4],[4,6],[3,8],[5,7],[6,9],[8,10]] Output: 3
For example [1, 3], [4, 6], and [6, 9].
Input: talks = [[0,40],[10,15],[20,25]] Output: 2
Skip the long talk and attend the two short ones.
0 <= talks.length <= 1000000 <= start < end <= 10^9Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #577 Most Talks One Person Can Attend. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.