You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your solutions demonstrate a good understanding of the problems and you are using efficient approaches. However, there are a few areas for improvement:
Variable Naming and Typos: In Problem1.py, you have a typo in the variable name runinSumMapFreq. You defined it as runinSumMapFreq (with an 'n') but then you use runinSumMapFreq (with an 'n' in the first part and then without the 'n' in the update part). This inconsistency will cause a NameError. Always use consistent and meaningful variable names. Consider using prefix_sum_freq or running_sum_freq to make it clear.
Code Correctness: For Problem1.py, without the typo, the logic is correct. However, it's important to test your code with sample inputs to catch such errors. For example, with nums = [1,1,1] and k=2, your code (with the typo fixed) should return 2.
Efficiency: Your solutions are efficient with optimal time and space complexity. Keep it up.
Code Readability: Your comments are helpful. However, in Problem1.py, the comment says "runinSumMapFreq" which is misspelled. Also, the comment could be more precise: explain why we initialize with {0:1}.
General Practice: Always double-check your variable names for typos. Using an IDE with syntax highlighting can help. Also, consider writing tests for your code.
For Problem2.py and Problem3.py, your solutions are correct and efficient. Well done.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
No description provided.