solve zigzag, atoi and palindrome number