Small improvement - removed unnecessory condition check
Solved: stacks using array