bug in chapter 1 question 1 solution 2#16
bug in chapter 1 question 1 solution 2#16noorgrewal wants to merge 2 commits intocareercup:masterfrom
Conversation
|
It did split in the ch1-q1.spec.js: In fact in this repository, many test code ([ch\d-q\d].spec.js) involving string manipulation split the primitive string into an array of string, then pass it as argument into function (in [ch\d-q\d].js): This kind of assignment operation is only available to array, if we assume the input is already an array, the space complexity could be |
|
If the input is indeed a string and not an array. The worse case complexity would be O(n^2) as |
Hello,
I hope you are doing well.
I noticed a bug in the solution code for ch1-q1-solution2, specifically the function
hasUniqueCharactersSort(). We cannot sort a string directly in Javascript - we have to convert the string to an array and then perform the sorting operation on it.I have fixed the bug. Also, I have attached 2 screenshots below that show the reproduced bug and that the fix works.
Thank you for providing these solutions. Overall, they are very helpful : )
Best,
Noor
Before the fix:

After the fix:
