Skip to content
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

Artemis: Refactor and Optimize Methods in Double Class #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mike-turintech
Copy link
Member

This pull request refactors and optimizes several methods in the Double class to improve performance and readability. Key changes include:

  1. sumSquare Method: Replaced nested loop with a direct formula, improving performance from O(n^2) to O(n).
  2. sumTriangle Method: Simplified the calculation of triangular numbers using a direct formula, enhancing clarity and reducing complexity.
  3. countPairs Method: Utilized a HashMap to count occurrences, improving performance from O(n^2) to O(n).
  4. countDuplicates Method: Removed unnecessary nested loops, simplifying the logic and improving efficiency.

Overall, these changes make the code cleaner and more maintainable.

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.

2 participants