Shita Mekubetzes (Bava Basra 39b): Whatever is said in front of three people is not considered lashon harah… It is clear that for grievances which are between a person and his fellow man for which there is no atonement until he repents or until the offended person forgives him but he isn’t willing to forgive him or other sins that the person continues doing intentionally and not accidentally but are his normal activity – that it is a mitzva to degrade him before all men…so that people stay away from his evil ways…and to motivate him to repent. This is what is meant by this gemora, “All things which are said in front of three people it is not considered lashon harah” and it is permitted to say if they are true. However to say these words of criticism in front of one or two people it seems that his only concern is to say lashon harah and he is doing it only to degrade the person and he is enjoying speaking lashon harah about the person. However if he says it in the presence of three then it is a public statement and it can be assumed that he wants his criticism to reach the person’s ears so that he can reform his deeds. For example in the case where the speaker knows that the person will not accept chastisement and will not repent by rebuke alone, but if he hears that people are complaining about him he will repent. Another justification for criticizing him in public is so that other people will not be influenced to follow in his ways when they hear that people are condeming his sinful ways. There is an additional reason why it is considered lashon harah if he voices his criticism before one or two people because it looks like he intends that his words will not eventually be heard by the sinner. Thus he looks like he is publicly praising the person but in private he is criticizing and enjoying speaking lashon harah and - thus he is acting in a devious way. However this that he is required to act in a way that what he says eventually is heard by the other person is only when the one he is speaking about is not someone to be afraid of. However if the other one is stronger or more powerful and he is afraid of being hurt if he speaks publicly it is permitted to speak critically about him in private and publicly praise him. Our Sages say in such a case it is permitted to falsely flatter the wicked.