A project dashboard shows one activity feed built from two sources: comments and commits. Each source is an array of timestamps (in seconds), already sorted from oldest to newest.
Write mergeFeeds(comments, commits) that returns a single array with every timestamp from both sources, sorted from oldest to newest. Keep repeated timestamps. Don't call sort: use the order you already have.
Input: comments = [100,400,900], commits = [200,300,1000,1200] Output: [100,200,300,400,900,1000,1200]
The feeds interleave by time.
Input: comments = [50,60], commits = [] Output: [50,60]
With no commits, the feed is just the comments.
0 <= comments.length, commits.length <= 1000000 <= timestamps <= 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 #111 Merge Two Activity Feeds. 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.