Skip to content

Instantly share code, notes, and snippets.

View obredan's full-sized avatar
💭
I may be slow to respond.

Owen obredan

💭
I may be slow to respond.
View GitHub Profile
@obredan
obredan / flatten_array.js
Created July 30, 2019 23:05
Software Engineer Screener
/**
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