I need to solve the following problem in $\mathbf{x} \in \mathbb R^p$.
$$\min_{\mathbf{s} \in [-1,1]^p}\left\Vert \mathbf{x}-\lambda\mathbf{s}\right\Vert _{2}$$
where $\mathbf{s} \in \mathbb R^p$ and $\lambda>0$ are given. I could not make any progress. How to solve this problem?
EDIT: It seems the problem is modified version of the problem 4.12 of the book Statistical learning with sparsity.
You can change the objective function to $\|\frac{x}{\lambda} - s\|_2$; the solution will be the same. Then you are just performing a projection of $x/\lambda$ onto the cube $[-1, 1]^p$, which is given by a "clipping" each component of $x/\lambda$ to the interval $[-1, 1]$. $$s_i = \text{Proj}_{[-1, 1]} (x_i / \lambda) = \min\{\max\{x_i / \lambda, -1\}, 1\}$$