Add solution of the problems from 18 to 27

Most of these problems require to def a func, and some problems even
are restricted not to use some forms or build-in functions.