Problem Statement
Heuristics:
Let, N be the number which is next in fixed order.
Take an input X, if it is equal to N then next number will be n++. If not, then search for N in the side lane and after finishing the search, put X in the side lane.
After all X is processed but N is not found in either X or side lane, then the order is not possible.
Solution:
Heuristics:
Let, N be the number which is next in fixed order.
Take an input X, if it is equal to N then next number will be n++. If not, then search for N in the side lane and after finishing the search, put X in the side lane.
After all X is processed but N is not found in either X or side lane, then the order is not possible.
Solution:
Comments
Post a Comment