It seems to me that the biggest problems with this is resetting brain’s weight set point. And to do that, you need to keep maintaining the same weight for a good while.
Also, “within the same year” - how many months was that? Because it’s very well possible that you’ve been eating less than healthy and gained because of that. By less than healthy, I’m mostly talking about seed oils and PUFA because they seem to play a crucial role in gaining weight. Depleting PUFA from fat tissues is a long process and unless the PUFA intake is controlled, regaining weight is inevitable