“Output the lexicographically smallest valid object” or “construct any object, building it step by step”. The recipe: decide positions left to right, and at each step take the smallest choice for which the remaining problem is still feasible. Correctness needs a fast, exact feasibility test.

ProblemFeasibility test
smallest permutation with an I/D patternnone needed: reverse each maximal D-run of the identity
smallest permutation with inversionsthe rest can produce any count in
smallest string with given letter counts and no two equal adjacentthe most frequent remaining letter fits:
smallest sequence with prefix constraintsa range of reachable sums for the suffix
valid bracket sequence of length , smallestopen while opens remain and balance allows
tree from degree sequenceattach a leaf to the smallest vertex still needing an edge (Prüfer order)

Smallest permutation for an increase/decrease pattern

vector<int> smallestFromPattern(const string& s) {   // s[i] = 'I' (p[i] < p[i+1]) or 'D'; lexicographically smallest
    int n = sz(s) + 1; vector<int> p(n); iota(all(p), 1);
    for (int i = 0; i < n - 1;) {
        if (s[i] == 'I') { i++; continue; }
        int j = i; while (j < n - 1 && s[j] == 'D') j++;
        reverse(p.begin() + i, p.begin() + j + 1); i = j;
    }
    return p;
}

Related: Greedy, Permutation Constructions.