Skip to content

NW| 26-Jul-SDC | Ahmad Hmedan | Sprint 2 | Improve code with precomputing - #236

Open
AhmadHmedann wants to merge 4 commits into
CodeYourFuture:mainfrom
AhmadHmedann:improve_with_precomputing
Open

AhmadHmedann wants to merge 4 commits into
CodeYourFuture:mainfrom
AhmadHmedann:improve_with_precomputing

Conversation

@AhmadHmedann

@AhmadHmedann AhmadHmedann commented Oct 4, 2026 •

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1183

Changelist

Speed up the solutions by introducing precomputing

@github-actions

This comment has been minimized.

@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 4, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 4, 2026
@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 4, 2026
Comment on lines +10 to +16
seen = set()
longest = ""
for string_index, string in enumerate(strings):
for other_string in strings[string_index+1:]:
common = find_common_prefix(string, other_string)
if len(common) > len(longest):
longest = common
return longest

for string in strings:
for i in range(1, len(string) + 1):
prefix = string[:i]
if prefix in seen and len(prefix) > len(longest):
longest = prefix

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use complexity to explain how the new implementation is better than the original implementation?

@cjyuan 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 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants