Distributing $n$ different things among $r$ distinct groups such that all of them must get atleast $1$

It's actually helpful here to generalize the problem to distributing $n$ different objects to $3$ people (with $n\ge3$ so that each person can be guaranteed getting at least one item). If you disregard the requirement that each person get at least one item, then you get the overestimate $3^n$. From this, let's subtract the number of ways you can pick one person to not get any items, distributing the rest to the other two, giving

$$3^n-3\cdot2^n$$

But this now under-estimates because you're now doublecounting occasions when two people fail to receive any items. So we need to add back in the number of ways this can happen, producing

$$3^n-3\cdot2^n+3\cdot1^n$$

As a sanity check, consider the case $n=3$, where there are clearly $6$ ways to assign an item to each person:

$$3^3-3\cdot2^3+3=27-24+3=6$$

For $n=7$, the formula gives

$$3^7-3\cdot2^7+3 = 2187-3\cdot128+3=1806$$

The general principle here is known as inclusion-exclusion. Note that it gives the correct answer, $0$, even for $n=1$ and $2$.