Python | Leetcode Python题解之第553题最优除法
题目;
题解:
class Solution:
def optimalDivision(self, nums: List[int]) -> str:
if len(nums) == 1:
return str(nums[0])
if len(nums) == 2:
return str(nums[0]) + "/" + str(nums[1])
return str(nums[0]) + "/(" + "/".join(map(str, nums[1:])) + ")"