The question states: Let $R$ be a commutative ring with unity and let $A,B\subseteq R$ be two ideals, find a necessary and sufficient condition for $\mathrm{Hom}(R/A,R/B)=0$.
Since $\mathrm{Hom}(R/A,R/B)\cong(B:A)/B$, so I guess one such condition is $(B:A)=B$.
Update (see comments below):
Before I found the reference of that isomorphism, the original guess ($A+B=(1)=R$) serves a sufficient condition since $A+B=R\rightarrow(B:A)=B$.