solutios to leetcode 50