How can I get rid of ugly brown spots that are left behind from pimples?

Time. Postinflammatory hyperpigmentation goes away in a couple of months. If you are hard-core you can experiment with over-the-counter hydroxyquinone creams. Most people would probably say this is not worth the trouble and nuisance, but it's your decision.
IPL/ cosmetic laser. You can also use hydroquinone cream. Definitely see a physician to help you select the right treatment.

Related Questions

I have brown spots on my back & chest due to acne. What can get rid of them? I've had them all my life. Went 2 Derm & gave me trentinoin, doesnt work!

Not treatable. Some of the spots are probably due to acne while others are probably solar lentigos. The acne marks fade after several months; the others are permanent. Watch your skin for signs of melanoma. If you still have acne, manage it. Use a sunscreen. Many of my students, make and female, have these spots; no one minds; they are relics of a vigorous youth. Read more...