Hope your new year was wonderful! Day 2!

The Problem

Write a function that accepts an array of numbers, this can be an array with any number of nested arrays. Flatten the array (make all one level), put it in numerical order of distinct numbers from the original array

Examples:

    flatten([1, 1, 5, 9])  //[1, 6, 9]   
    flatten([20, [3, 5], 10])  //[3, 5, 10, 20]   
    flatten([[1,2,3],[[4,5],6,[7,8,9], 19, 21, [0, 1], ]])  //[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 21]
Previous
Previous

Flatten and Sort an Array of Arrays JavaScript

Next
Next

Advanced Palindrome Interview Question JavaScript