mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-15 22:08:02 +00:00
Polish unique chars challenge and solution
Add None input test case. Update constraints.
This commit is contained in:
@@ -34,12 +34,14 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
"* Can you assume the string is ASCII?\n",
|
||||
"* Can we assume the string is ASCII?\n",
|
||||
" * Yes\n",
|
||||
" * Note: Unicode strings could require special handling depending on your language\n",
|
||||
"* Can we assume this is case sensitive?\n",
|
||||
" * Yes\n",
|
||||
"* Can you use additional data structures?\n",
|
||||
"* Can we use additional data structures?\n",
|
||||
" * Yes\n",
|
||||
"* Can we assume this fits in memory?\n",
|
||||
" * Yes"
|
||||
]
|
||||
},
|
||||
@@ -49,6 +51,7 @@
|
||||
"source": [
|
||||
"## Test Cases\n",
|
||||
"\n",
|
||||
"* None -> False\n",
|
||||
"* '' -> True\n",
|
||||
"* 'foo' -> False\n",
|
||||
"* 'bar' -> True"
|
||||
@@ -112,6 +115,7 @@
|
||||
"class TestUniqueChars(object):\n",
|
||||
"\n",
|
||||
" def test_unique_chars(self, func):\n",
|
||||
" assert_equal(func(None), False)\n",
|
||||
" assert_equal(func(''), True)\n",
|
||||
" assert_equal(func('foo'), False)\n",
|
||||
" assert_equal(func('bar'), True)\n",
|
||||
@@ -146,21 +150,21 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.10"
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user