Skip to content

Conversation

@Mikiyas-STP
Copy link

@Mikiyas-STP Mikiyas-STP commented Oct 15, 2025

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

Changelist

Precomputing means doing calculations once in advance and reusing the results instead of repeating the same work.
It makes programs faster by trading extra memory for reduced computation time.
For example, counting all characters once and storing the results is faster than scanning the string repeatedly.

Questions

None

@Mikiyas-STP Mikiyas-STP added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

5 similar comments
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@Mikiyas-STP Mikiyas-STP added 📅 Sprint 2 Assigned during Sprint 2 of this module Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Complexity The name of the module. and removed Complete Volunteer to add when work is complete and all review comments have been addressed. labels Oct 15, 2025
@OracPrime OracPrime added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jan 26, 2026
Copy link

@OracPrime OracPrime left a comment

Choose a reason for hiding this comment

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

Prefix code is wrong.
Counting code works, but could be more efficient.

#Find shortest string limit for prefix
min_len = min(len(s) for s in strings)
if min_len == 0:
return ""

Choose a reason for hiding this comment

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

No, this is wrong. If the input is ["","string_one","string_two"] we want to return "string_" whereas you'll return ""

def is_upper_case(letter: str) -> bool:
return letter == letter.upper()
#Returns the number of letters which only occur in uppercase in the passed string
letters = Counter(s) #count occurrences of each character

Choose a reason for hiding this comment

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

This works, but is doing more work than is needed. We don't care if T occurs 3 times or 1, if t doesn't. What could you use instead of a Counter that would skip the counting process but still remove duplicates?

@OracPrime OracPrime added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Complexity The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants