Stack Partition Challenge


#1

Q1: It is not quiet clear to me what type of stack structure must be used for Algo II advanced challenges, such as Partition. Should be SinglyLinked structure, array- or object-oriented structure?

Q2: Can I use the JavaScript native constructors and built-in methods (such as, concat(), push(), pop(), reduce()) for the prototype method shown below?

	Stack.prototype.partition = function() {
		let count = 1;
		let pos = new Array();
		let neg = new Array();
		while(this._storage[count] || this._storage[count] == 0){
			if (this._storage[count] > 0){
				pos.push(this._storage[count]);
			}
			else{
				neg.push(this._storage[count]);
			}
			count++;
		}
		return neg.concat(pos).reduce(function(stack,value,idx){			
			stack[idx+1] = value;
			return stack;			
		},{});		
	}