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
{{ message }}
Repository navigation
London | 26-Jul-SDC | Shaghayegh Far| Sprint 2 | Improve code with pre-computing - #258
The reason will be displayed to describe this comment to others. Learn more.
Could you use complexity to explain how the new implementation is better than the original implementation?
cjyuan
added
Reviewed
Volunteer to add when completing a review with trainee action still to take.
and removed
Needs Review
Trainee to add when requesting review. PRs without this label will not be reviewed.
labels
Oct 15, 2026
shaghayeghfar
changed the title
London | 26-Jul-SDC | Shaghayegh Far| Sprint 2 | Improve code with pre-computing Needs Review
London | 26-Jul-SDC | Shaghayegh Far| Sprint 2 | Improve code with pre-computing
Oct 21, 2026
Dear @cjyuan
thank you for taking time and check my code, I really appreciate it .
about for question :
For count_letters, the original implementation checks whether each uppercase letter's lowercase version exists in the string. The in operation on a string takes O(n) time, so repeating it for each character gives O(n²) time complexity.
The new implementation uses sets to collect uppercase and lowercase letters in one pass, then checks membership in the lowercase set. Set lookups take O(1) on average, so the overall time complexity is O(n) on average.
Therefore, the new implementation improves the time complexity from O(n²) to O(n), making it more efficient for longer strings.
shaghayeghfar
added
Needs Review
Trainee to add when requesting review. PRs without this label will not be reviewed.
and removed
Reviewed
Volunteer to add when completing a review with trainee action still to take.
labels
Oct 21, 2026
How about find_longest_common_prefix()? How much better is the new implementation compare to the original one?
cjyuan
added
Reviewed
Volunteer to add when completing a review with trainee action still to take.
and removed
Needs Review
Trainee to add when requesting review. PRs without this label will not be reviewed.
labels
Oct 21, 2026
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
ReviewedVolunteer to add when completing a review with trainee action still to take.
2 participants
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.
Learners, PR Template
Self checklist
Task code
CYF-1183