Let $f: [0,1] \to [0, \infty)$ be a measurable function satisfying $$\int_A f \le |A|^{1/q}$$ for some $q \ge 2$ and all measurable subsets $A \subset [0,1]$. Show that $f\in L^p[0,1]$ for all $1 < p < \frac{q}{q-1}$. Is $f$ necessarily in $L^{\frac{q}{q-1}}[0,1]$?
I solved the first part. Apply the given inequality to the sets $A_t := \{f > t\}$ for $t\in \Bbb R$, to get $$t |A_t| \le \int_{A_t} f \le |A_t|^{1/q},$$ i.e., $$|A_t| \le t^{\frac{q}{1-q}}.$$ Using $$\int_0^1 f^p = p\int_0^\infty t^{p-1} |A_t| \, dt$$ we get $$\int_0^1 f^p \le p + \frac{p}{\frac{q}{q-1} - p} < \infty$$ for $1 < p < \frac{q}{q-1}$.
Could someone help me produce a measurable function $f: [0,1] \to [0, \infty) \notin L^{\frac{q}{q-1}}[0,1]$ satisfying $$\int_A f \le |A|^{1/q}$$ for some $q \ge 2$ and all measurable subsets $A \subset [0,1]$?