for a valid stack permutation, check the options. if they are in increasing order then so far so good. if we encounter a lower valued number, it should be the most recently used one sequentially.
option a :- 3,4 (increase), 1 reject (decrease, incorrect as it should;ve been 2 here then 1)
option b :- 4,3(decrease but ok as 3 immediately precedes 4,) 1 (reject as the no immediately preceding the seen nos should be 2 not 1)
option c:- increasing order, hence valid
similar valid permutations :- 4321 , all immediately preceding the previous when decreasing, 2314, 2341 etc.