If $a_1,a_2\dots a_n$ and $b_1,b_2\dots b_n$ are two rearrangement of $1,2,\dots n$, Find the minimum and maximum values of $$\sum_{i=1}^na_ib_i$$
I found the maximum to be $\sum i^2$ using Cauchy-Schwarz.
Also WLOG $\sum_{i=1}^na_ib_i=\sum_{i=1}^nib_i$
How to proceed for minimum value?
HINT
Refer to rearrangement inequality
$$\sum_{i=1}^n a_i\cdot b_i\ge\sum_{i=1}^n a_i\cdot b_{\sigma(i)} \ge \sum_{i=1}^n a_i\cdot b_{n+1-i}$$
where $a_1\le a_2\le \cdots \le a_n$ and $b_1 \le \cdots \le b_n$.