Find $y$ such that it makes $\sum_{i=1}^{n}n_i |y-i|$ takes the minimum value. In the above expression, $n_i\ge1$, $i\gt0$.
I can tell you the answer of $y$ might be the weighted median of $i's$, however I don't know how to prove it.
First example: $1,1,2,2,2$, median is $2$, $y=2$, min is $2$.
Second example: $1,1,2,2,3,3,3,3$, median is $2.5$, min is $6$.
Edit
From the comment, here is the proof for $n_i=1$, and it is for real numbers.
It lead me to think maybe my problem can also extended to real number case.