This is Catalan Number.
https://math.stackexchange.com/questions/1431923/how-many-sequences-possible-in-stack-if-the-input1-2-3-n-is-in-order
@h4kr There are $C_5 = 42$ possible permutations for the sequence $(1,2,3,4,5)$ using stack.
64.3k questions
77.9k answers
244k comments
80.0k users