will post the answers to leecode here