Skip to content

Simplify Capitalize Function #12879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Miladkhoshdel
Copy link
Contributor

Changes:

  • Removed dependency on string.ascii_lowercase and string.ascii_uppercase and Replaced string-based capitalization with manual ASCII offset
  • Reduced function complexity and branching
  • Added basic unit tests to ensure correctness

Benefits:

  • Eliminated external module dependency (string) for better portability and reduced overhead
  • Improved performance (5× faster in benchmarks)
  • More efficient implementation
  • Maintains readability and correctness

Checklist:

  • Code compiles without errors
  • Performance verified with benchmarks

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Aug 24, 2025
@MaximSmolskiy MaximSmolskiy changed the title Simplify Capitalize Function Using ASCII Arithmetic for 5x Performance Boost Simplify Capitalize Function Aug 24, 2025
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Aug 24, 2025
@MaximSmolskiy MaximSmolskiy merged commit a8c5616 into TheAlgorithms:master Aug 24, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants