Correct Space Complexity and Optimized Solution for LeetCode 383: Ransom Note #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How are you doing Greg,
I've identified an issue with the current solution for LeetCode 383: Ransom Note. The existing solution did not accurately reflect the correct space complexity, which I have now corrected. Additionally, I've optimized the code to make it more clear and concise keeping the same logic ofcource(I used the Counter function instead of a manual for loop to populate the hashmap.).
Changes:
-> Renamed counter to hashmap to undo any confusion in other languges
-> Corrected the space complexity analysis in the comments.
-> Refined the code for better readability and efficiency.
I also want to mention that Algomap has been incredibly useful, and I've been actively using it to improve my problem-solving skills. Thank you for this great resource!
Looking forward to your feedback.
Best regards,
Tesfamichael