Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Str Diff Solution #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions arrays_strings/str_diff/str_diff_solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
" if seen[char] < 0:\n",
" return char\n",
" for char, count in seen.items():\n",
" return char\n",
" if (count == 1): return char\n",
"\n",
" def find_diff_xor(self, str1, str2):\n",
" if str1 is None or str2 is None:\n",
Expand Down Expand Up @@ -160,6 +160,7 @@
" self.assertRaises(TypeError, solution.find_diff, None)\n",
" self.assertEqual(solution.find_diff('ab', 'aab'), 'a')\n",
" self.assertEqual(solution.find_diff('aab', 'ab'), 'a')\n",
" self.assertEqual(solution.find_diff('baa', 'ab'), 'a')\n",
" self.assertEqual(solution.find_diff('abcd', 'abcde'), 'e')\n",
" self.assertEqual(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')\n",
" self.assertEqual(solution.find_diff_xor('ab', 'aab'), 'a')\n",
Expand Down Expand Up @@ -212,9 +213,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
}
1 change: 1 addition & 0 deletions arrays_strings/str_diff/test_str_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def test_find_diff(self):
self.assertRaises(TypeError, solution.find_diff, None)
self.assertEqual(solution.find_diff('ab', 'aab'), 'a')
self.assertEqual(solution.find_diff('aab', 'ab'), 'a')
self.assertEqual(solution.find_diff('baa', 'ab'), 'a')
self.assertEqual(solution.find_diff('abcd', 'abcde'), 'e')
self.assertEqual(solution.find_diff('aaabbcdd', 'abdbacade'), 'e')
self.assertEqual(solution.find_diff_xor('ab', 'aab'), 'a')
Expand Down