I am sure there is a general and simplified way to solve this problem, I am just unable to figure out the generalized formula (if there is one).
Say we have to write a code with 4 digits, the digits can range from 0 to 9.
All digits in the code must be unique.
All of the digits cannot be neither increasing nor decreasing.
For example, "1234" is not allowed, neither is "1289" nor "9821".
How many code combinations are there in total?