problem 30
added test cases for example problem