Python One-Line Solution


  • 0
    M
    class Solution(object):
        def optimalDivision(self, nums):
            return '{}/({})'.format(nums[0], "/".join(str(num) for num in nums[1:])) if len(nums)>2 else "/".join(str(num) for num in nums)
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.