This is very dependent on the program.
Reasoning behind rest scheduling
If you're strength training, the recovery time is largely based on how much time it takes to move into supercompensation. It's easiest to manage your program if you do full body workouts, so the amount of rest needed is uniform across your body, and you can schedule full rest days.
If you're body building, the same principle applies, but body builders tend to work a particular set of muscle groups to exhaustion each day with higher rep ranges and multiple exercises per body part, which takes more time, and tends to prevent full-body coverage in every workout. Thus, they can come back the next day and work an alternate set of muscles.
Hasty generalizations
If you're doing a program like starting strength or stronglifts and you're going hard (new maximums) every day you're in the gym, you need a rest day between each workout.
If you're a beginner body builder, you're probably doing a general strength program like starting strength or stronglifts anyway, so the advice might be the same. But it depends on the program.
As an intermediate powerlifter, there is a different periodization approach that starts with the same number of rest days, but one of the "work days" is also a light day, so you really only go hard twice per week. Later on, intermediate powerlifters might add an extra work day per week into the mix.
Programs for intermediate bodybuilders tend to focus on body-part splits rather than full-body workouts, so don't need as many full days off, because they're not working the full body hard on any one day. They might take only one or two days off per week.
Related background reading