Problem: Given $n \in \mathbb{Z}_+$ and a set $A \subset \{ 1,\ldots,n \}$ sorted in ascending order, find the number of permutations $\sigma \in S_n$ such that $A$ is a longest increasing subsequence of $\sigma$.
($A$ need not be the only longest increasing subsequence of $\sigma$.)
A solution might be expressed as a formula or an algorithm.
This question is inspired by this puzzle on Puzzling SE. Can you get a solution efficient enough to answer that question? Clearly, checking all $n!$ permutations is out of the question, as each one requires $O(n\log n)$ time by a clever Patience Sort algorithm (or $O(n^2)$ by dynamic programming).