This is answer for leetcode