The only solution is to find and fix the water leak and then replace the damaged floor. Novices typically do not replace a large enough area and they fail to make sure all the edges of the repair section are supported properly. Many repairs are attempted by cutting out the damaged particle board and fitting in a new piece. This can be difficult and time consuming work because you are having to cut the old floor away half way across the joists without damaging the joist or the existing floor.
The most common place for damage is the bathroom floor and frequently the damage extends under the wall to the bedroom. If the wall is not resting on a joist and you cut the flooring at the bathroom edge of the wall, the wall is no longer supported properly. I was much happier repairing floors by covering the old floor completely with new plywood. My time and materials costs were no larger and I produced a floor I knew I would never cause problems. It turns out that the height of the new plywood is about equal to the height of carpet. So if I was replacing a vinyl floor in a carpeted home the extra height was not a problem.