Skip to content

Instantly share code, notes, and snippets.

Avatar

P13RC3 P13RC33

View GitHub Profile
@P13RC33
P13RC33 / flatten_array.js
Created Jul 30, 2019
Software Engineer Screener
View flatten_array.js
/**
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
Your solution should be a link to a gist on gist.github.com with your implementation.
When writing this code, you can use any language you're comfortable with. The code must be well tested and documented if necessary, and in general please treat the quality of the code as if it was ready to ship to production.
Try to avoid using language defined methods like Ruby's Array#flatten.*
*/
'use strict';
// exam if the array is already flattened
// returns true/false
You can’t perform that action at this time.