Max, Ruby and Steve shared a packet of sweets. The ratio of the total number of sweets Ruby and Steve received to the number of sweets Max received was 2:3. After Max gave 9 sweets to Ruby and 23 sweets to Steve, the 3 children had the same number of sweets in the end. How many sweets did Ruby have in the end?

At the start:

Max has m sweets
Ruby has r sweets
Steve has s sweets
(r+s)/m = 2/3
2m = 3r + 3s ***

after exchange:
Max has m-32 , he gave 9 to Ruby and 23 to Steve
Ruby has r+9
Steve has s+23 , but these are equal, so
m-32 = r + 9
r = m - 41 ***

m-32 = s + 23
s = m - 55 ****

sub *** and **** into **

2m = 3r + 3s
2m = 3(m-41) + 3(m-55)
2m = 3m - 123 + 3m - 165
288 = 4m
m = 72 , r = 31 , s = 17 <---- before the exchange

so.... after exchange each will have 40