Add solution for #18
Add solution for #124