Skip to content

Artemis: Refactor and Optimize Methods in Double Class#34

Open
mike-turintech wants to merge 1 commit intomainfrom
artemis-fb9e003b-35c8-4bc7-bd00-e58b7e86edad
Open

Artemis: Refactor and Optimize Methods in Double Class#34
mike-turintech wants to merge 1 commit intomainfrom
artemis-fb9e003b-35c8-4bc7-bd00-e58b7e86edad

Conversation

@mike-turintech
Copy link
Copy Markdown
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