I have some trouble,could you help me?


  • -2
    Y

    there is my code
    class Solution(object):
    def combinationSum4(self, nums, target):
    """
    :type nums: List[int]
    :type target: int
    :rtype: int
    """
    if target==0:
    return 1
    elif target<0:
    return 0
    else:
    sum=0
    for i in nums:
    sum=sum+combinationSum4(self,nums,target-i)
    return sum

    Line 15: NameError: global name 'combinationSum4' is not defined
    I don't know the reason,I hope you can help me.Thank you very much!


  • 0

    @yujuan110 Provide more details about your problem: language, your thoughts, what you have tried and at last but not the least is that you should really format your code properly using ``` backquotes.


Log in to reply
 

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