When I have a small amount of leftover foreign currency-- "small" being up to a few USD worth-- I keep it as a souvenir. It's not worth the effort to change it, and I appreciate the souvenir. Sometimes I give the souvenirs to young relatives to spark a lesson about geography, foreign culture, language, etc.
I've been successful most trips at keeping my leftovers small by shifting my purchases to cash the last day or two of the trip. Of course, if I anticipate needing the currency again in a few months I don't sweat it. In fact it's useful to have local currency in pocket when going back, in case a suitable ATM or money-changer is not available right away upon arrival.