add some comments in tengjing's solution3.
It is a smarter way.