Proof of Work · Challenge
A teammate's code passes the obvious case. Find what it gets wrong, then fix it.
about 20 min · 6 required tests · in the browser
What is recorded: when you save, your Result page shows your code, which tests passed, how many times you ran the tests, how many versions you tried, the time from first run to save, and the largest jump in code between runs. Anyone with the link can see it. The suggested time is not enforced.
A teammate opened a pull request with mergeIntervals. The calendar view uses it to join busy time into blocks. It works on the example they tried, and it is already in your editor.
Review it the way you would review a real pull request. Read it first, then fix what is wrong. You can keep their structure or rewrite it.
mergeIntervals(intervals) takes an array of [start, end] pairs in any order and returns the merged pairs, sorted by start.
mergeIntervals([[1, 3], [2, 6], [8, 10]])
// [[1, 6], [8, 10]]Requirements:
[1, 3] and [3, 5] become [1, 5].The Result shows your code and the tests. In the interview, expect to explain what you found and how you would word the review comment.
Write a top-level function named mergeIntervals. Do not use export or module.exports.
Press Esc, then Tab, to leave the editor.
⌘ / Ctrl + Enter runs the tests
Hiring developers? See how teams use this.
Graded on
0/6
Other builds
Send a candidate this Challenge. You get a Result with their code, the test results and questions to ask in the interview.
Send this Challenge