solutions for gcj questions