      "collapsed": false
     },
     "outputs": [],
     "source": [
      "def permutations(str1, str2):\n",
      "    if str1 is None or str2 is None:\n",
      "        return False\n",
      "    return sorted(str1) == sorted(str2)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
 
</s> remove     "def permutations_alt(str1, str2):\n",
    "    if str1 is None or str2 is None:\n",
    "        return False\n",
    "    if len(str1) != len(str2):\n",
    "        return False\n",
    "    unique_counts1 = defaultdict(int)\n",
    "    unique_counts2 = defaultdict(int)\n",
    "    for char in str1:\n",
    "        unique_counts1[char] += 1\n",
    "    for char in str2:\n",
    "        unique_counts2[char] += 1\n",
    "    return unique_counts1 == unique_counts2"
 </s> add     "class PermutationsAlt(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        if str1 is None or str2 is None:\n",
    "            return False\n",
    "        if len(str1) != len(str2):\n",
    "            return False\n",
    "        unique_counts1 = defaultdict(int)\n",
    "        unique_counts2 = defaultdict(int)\n",
    "        for char in str1:\n",
    "            unique_counts1[char] += 1\n",
    "        for char in str2:\n",
    "            unique_counts2[char] += 1\n",
    "        return unique_counts1 == unique_counts2" </s> remove     "def permutations(str1, str2):\n",
    "    # TODO: Implement me\n",
    "    pass"
 </s> add     "class Permutations(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        # TODO: Implement me\n",
    "        pass" </s> remove     "        test.test_permutation(permutations_alt)\n",
 </s> add     "        permutations_alt = PermutationsAlt()\n",
    "        test.test_permutation(permutations_alt.is_permutation)\n", </s> remove     "        test.test_permutation(permutations_alt)\n",
 </s> add     "        permutations_alt = PermutationsAlt()\n",
    "        test.test_permutation(permutations_alt.is_permutation)\n", </s> remove     "    test.test_permutation(permutations)\n",
 </s> add     "    permutations = Permutations()\n",
    "    test.test_permutation(permutations.is_permutation)\n",
    "class Permutations(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        if str1 is None or str2 is None:\n",
    "            return False\n",
    "        return sorted(str1) == sorted(str2)"
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "class Permutations(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        if str1 is None or str2 is None:\n",
    "            return False\n",
    "        return sorted(str1) == sorted(str2)"
    "class Permutations(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        if str1 is None or str2 is None:\n",
    "            return False\n",
    "        return sorted(str1) == sorted(str2)"
    "class Permutations(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        if str1 is None or str2 is None:\n",
    "            return False\n",
    "        return sorted(str1) == sorted(str2)"
    "class Permutations(object):\n",
    "\n",
    "    def is_permutation(self, str1, str2):\n",
    "        if str1 is None or str2 is None:\n",
    "            return False\n",
    "        return sorted(str1) == sorted(str2)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Move string permutation to a class 
arrays_strings/permutation/permutation_solution.ipynb