DevPrep

All topics › Real interview tasks

Unique numbers from nested arrays, descending

Junior PRO

Task

Write a function that returns the unique numbers sorted in descending order:

[[7, 72, 3, 4], [1, 3, 4, 4, 4, 65], [6, 3, 4, 5, 6, 1, 1, 1, 6, 9]]
// -> [72, 65, 9, 7, 6, 5, 4, 3, 1]

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store