I want to characterize the set $ S $ of continuous functions $ f colon I to mathbb R $ so for everyone $ n ge 0 $ and for every polynomial $ P $ of the degree $ n $, The equation $ f (x) = P (x) $ has at most $ n + 1 $ solutions.
To do this, I found it useful to recall:
lemma, To let $ g colon I to mathbb R $ be continuously differentiable. If $ g & # 39; $ has at most $ n $ Zeros in $ I $, then $ g $ has at most $ n + 1 $ Zeros in $ I $,
proof: Since $ g & # 39; $ has at most $ n $ There are zeros $ m le n $ and there are $ m + 1 $ intervals $[x_0 = inf I, x_1]. [x_1, x_2] dotsc [x_m, x_{m+1} = sup I]$ so that $ g & # 39; $ keeps the same sign $[x_i, x_{i+1}]$, That's why, $ g $ is monotone in each $[x_i, x_{i+1}]$and thus each has at most one zero $[x_i, x_{i+1}]$,
What I have found so far $ S $:

If $ f in S $, then $ f $ is injective (and thus monotonous). proof: To let $ y in mathbb R $, Since $ P (x) = y $ is a polynomial of degree $ 0 $ and $ f in S $, The equation $ f (x) = y $ has at most $ 1 $ Solution.

If $ f & # 39; in S $, then $ f in S $, proof: To let $ P $ be a polynomial of degree $ n $, Since $ P & # 39; $ has grad $ n1 $ and $ f & # 39; in S $, then $ f & # 39; (x) – P & # 39; (x) $ has at most $ n $ Zeros, that is, after the lemma $ f (x) – P (x) $ has at most $ n + 1 $ Zeros.

$ e ^ x in S $, proof: By induction on $ n $, The case $ n = 0 $ follows through injectivity. To let $ n> 0 $ and $ P (x) $ be a polynomial of degree $ n $, Through the inductive hypothesis, $ e ^ x – P # (x) $ has at most $ n $ Zeros, that is, after the lemma $ e ^ x – P (x) $ has at most $ n + 1 $ Zeros.

$ ln x in S $, proof: To let $ n ge 0 $ and $ P (x) $ be a polynomial of degree $ n $, Then $ 1 – x P & # 39; (x) $ is a polynomial of degree $ n $ and therefore has no more than $ n $ Zeros and so on $ frac 1 x – P # (x) $ also has at most $ n $ Zeros. Again, it follows from the lemma that $ ln x – P (x) $ has at most $ n + 1 $ Zeros.

If $ f in S $ and $ g (x) = a f (x) + b $ for some $ a, b in mathbb R $ With $ a neq 0 $, then $ g in S $,

If $ f in S $ and $ g (x) = f (a x + b) $ for some $ a, b in mathbb R $ With $ a neq 0 $, then $ g in S $,

Of course, no polynomial is included $ S $, Likewise, $ arcsin x $. $ arccos x $, and $ arctan x $ do not belong $ S $,
Is there a simple characterization of $ S $?
I do not mind limiting $ S $ to differentiable or even smooth functions, if it proves necessary to provide a simple characterization.