mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-05 08:58:02 +00:00
Merge pull request #49 from yask123/patch-1
Fix bug in permutations challenge and solution
This commit is contained in:
@@ -143,10 +143,10 @@
|
||||
"def permutations_alt(str1, str2):\n",
|
||||
" if len(str1) != len(str2):\n",
|
||||
" return False\n",
|
||||
" unique_counts2 = defaultdict(int)\n",
|
||||
" unique_counts1 = defaultdict(int)\n",
|
||||
" unique_counts2 = defaultdict(int)\n",
|
||||
" for char in str1:\n",
|
||||
" unique_counts2[char] += 1\n",
|
||||
" unique_counts1[char] += 1\n",
|
||||
" for char in str2:\n",
|
||||
" unique_counts2[char] += 1\n",
|
||||
" return unique_counts1 == unique_counts2"
|
||||
|
||||
Reference in New Issue
Block a user