dppp

    0

    0

    kushansuk2

    def dp(self, nums, target, index, curr_sum):
      # Base Cases
          if index < 0 and curr_sum == target:
              return 1
          if index < 0:
              return 0 
          
      # Decisions
          positive = self.dp(nums, target, index-1, curr_sum + nums[index])
          negative = self.dp(nums, target, index-1, curr_sum + -nums[index])
          
          return positive + negative
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.