In the current work we consider the numerical solutions of equations of stationary states for a general class of the spatial segregation of reaction–diffusion systems with $m\geq 2$ population densities. We introduce a discrete multi-phase minimization problem related to the segregation problem, which allows to prove the existence and uniqueness of the corresponding finite difference scheme. Based on that scheme, we suggest an iterative algorithm and show its consistency and stability. For the special case $m=2$, we show that the problem gives rise to the generalized version of the so-called two-phase obstacle problem. In this particular case we introduce the notion of viscosity solutions and prove convergence of the difference scheme to the unique viscosity solution. At the end of the paper we present computational tests, for different internal dynamics, and discuss numerical results.