examples with code to solve different problems