-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Code concerning Issue #38 #39
Conversation
Sorry for the three commits, it could have been done in one. (But I'm a commit hungry and streak hungry person 😛 ) |
the time and space complexity of your implementation are O(n) and O(n), as you specified? |
No, I haven't checked those. Let me check. Space complexity is O(n) as I haven't used any other variable or storage space. But time complexity may be affected by the nested if's I have added. |
@hashhar just a quick update...I haven't forgotten about this, I hope to get to it by the weekend. |
Thanks to let me know. Take your time. I have exams coming up anyway. |
@hashhar thanks again for the PR, here are some thoughts: The requirement change of "Improve compression by appending count only if count exceeds 2" makes a lot of sense, although it does make the solution a bit more complex. Perhaps we should make it a 'follow-up' type question and add another solution as opposed to modifying the existing solution? Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3B1C2D4'. Only compress the string if it saves space. What if you don't want to display 'B1' and instead want the output to be 'A3BC2D4'? Here's a notebook with multiple solutions as a template: Additional comments:
|
Thanks for the feedback. I'll get back onto it. |
@hashhar no rush! |
Fixed all of the issues you mentioned. Also, the |
@hashhar thanks for the revisions! I'll try to check it out within the next few days. |
@hashhar sorry, fell behind on this from the holidays. Just want to let you know it's still on my TODO list. |
@donnemartin Seems you are really busy. Just wanted to remind you. |
@hashhar thanks for the ping, sorry it's taking awhile, this is still on my short-term radar. I plan to circle back to this project very soon and invest a lot of time beefing it up, including clearing out pull requests. Thanks! |
Merged, thanks @hashhar! |
Improve compression by appending count only if count exceeds 2 ( #38 )
Changed Files:
arrays_strings/compress/compress_challenge.ipynb
arrays_strings/compress/compress_solution.ipynb
arrays_strings/compress/test_compress.py
Chagenlog:
compress_string
function with some helpful comments for explaining the changesEven in case it is not pulled, do comment on how I did and what I could have done to do it better.