Let x = amount of time (in minutes) that it takes painter B to do the job alone
1/30 = portion of job done by painter A per minute
1/x = portion of job done by painter B per minute
1/18 = portion of job done by both painters per minute
Then, 1/x + 1/30 = 1/18
Multiply by the LCD, 90x, to obtain 90 + 3x = 5x
90 = 2x x = 45 min