Skip to content

Artemis: Refactor and Optimize Methods in the Double Class#35

Open
mike-turintech wants to merge 1 commit intomainfrom
artemis-4581542f-b608-4f0a-b62d-e80fc71fe374
Open

Artemis: Refactor and Optimize Methods in the Double Class#35
mike-turintech wants to merge 1 commit intomainfrom
artemis-4581542f-b608-4f0a-b62d-e80fc71fe374

Conversation

@mike-turintech
Copy link
Copy Markdown
Member

This pull request introduces significant optimizations and refactoring to the methods in the Double class. Key changes include:

  1. Optimized sumSquare Method: Reduced time complexity from O(n^2) to O(n) by eliminating nested loops and using a direct calculation for the sum of squares.
  2. Refined sumTriangle Method: Improved efficiency by adjusting the loop range and simplifying the summation logic for triangular numbers.
  3. Rewritten countPairs Method: Enhanced performance from O(n^2) to O(n) by using a HashMap to count occurrences, simplifying the logic.
  4. Simplified countDuplicates Method: Increased readability and efficiency by removing inner loops and adding boundary checks.

Overall, these changes improve the performance and clarity of the Double class methods while preserving their original functionality.

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