      "class Parentheses(object):\n",
      "\n",
      "\n",
      "    def _find_pair(self, nleft, nright, curr_results, results):\n",
      "        if nleft == 0 and nright == 0:\n",
      "            results.append(''.join(curr_results))\n",
      "        else:\n",
      "            if nleft >= 0:\n",
 
</s> remove     "def pair_parentheses(n):\n",
    "    result_set = set()\n",
    "    if n == 0:\n",
    "        return result_set\n",
    "    parentheses_util(n, n, '', result_set)\n",
    "    return result_set"
 </s> add     "    def _find_pair(self, nleft, nright, curr_results, results):\n",
    "        if nleft == 0 and nright == 0:\n",
    "            results.append(''.join(curr_results))\n",
    "        else:\n",
    "            if nleft >= 0:\n",
    "                self._find_pair(nleft-1, nright, curr_results+['('], results)\n",
    "            if nright > nleft:\n",
    "                self._find_pair(nleft, nright-1, curr_results+[')'], results)" </s> remove     "def parentheses_util(no_left, no_right, pair_string, result):\n",
    "    if no_left == 0 and no_right == 0:\n",
    "        result.add(pair_string)\n",
    "    else:\n",
    "        if no_left > 0:\n",
    "            parentheses_util(no_left - 1, no_right, pair_string + '(', result)\n",
    "        if no_right > no_left:\n",
    "            parentheses_util(no_left, no_right - 1, pair_string + ')', result)\n",
 </s> add     "class Parentheses(object):\n", </s> remove     "def parentheses_util(no_left, no_right, pair_string, result):\n",
    "    # TODO: implement parentheses pairing here\n",
    "    pass\n",
    "\n",
 </s> add     "class Parentheses(object):\n", </s> remove     "def pair_parentheses(n):\n",
    "    result_set = set()\n",
    "    if n == 0:\n",
    "        return result_set\n",
    "    parentheses_util(n, n, '', result_set)\n",
    "    return result_set"
 </s> add     "    def find_pair(self, num_pairs):\n",
    "        # TODO: implement me\n",
    "        pass" </s> remove     test.test_pair_parentheses(pair_parentheses)
 </s> add     test.test_pair_parentheses()
    "    def find_pair(self, num_pairs):\n",
    "        if num_pairs is None:\n",
    "            raise TypeError('num_pairs cannot be None')\n",
    "        if num_pairs < 0:\n",
    "            raise ValueError('num_pairs cannot be < 0')\n",
    "        if not num_pairs:\n",
    "            return []\n",
    "        results = []\n",
    "        curr_results = []\n",
    "        self._find_pair(num_pairs, num_pairs, curr_results, results)\n",
    "        return results\n",
      "class Parentheses(object):\n",
      "\n",
    "    def find_pair(self, num_pairs):\n",
    "        if num_pairs is None:\n",
    "            raise TypeError('num_pairs cannot be None')\n",
    "        if num_pairs < 0:\n",
    "            raise ValueError('num_pairs cannot be < 0')\n",
    "        if not num_pairs:\n",
    "            return []\n",
    "        results = []\n",
    "        curr_results = []\n",
    "        self._find_pair(num_pairs, num_pairs, curr_results, results)\n",
    "        return results\n",
      "\n",
      "    def _find_pair(self, nleft, nright, curr_results, results):\n",
      "        if nleft == 0 and nright == 0:\n",
      "            results.append(''.join(curr_results))\n",
      "        else:\n",
      "            if nleft >= 0:\n",
keep add keep keep keep keep keep keep
 Rework n pairs parens challenge (#145) 
recursion_dynamic/n_pairs_parentheses/n_pairs_parentheses_solution.ipynb