I assume you mean Hangzhou? If so, I think 2 nights is sufficient, and 4 seems a bit too much for Nanjing as well. Given this is your 2nd trip and you haven't been to Beijing / seen the great wall, maybe consider taking 3 nights out of Hangzhou / Nanjing and flying to Beijing instead.