Skip to content

Fix armstrong logic#3156

Merged
geekcomputers merged 2 commits intogeekcomputers:masterfrom
2007aman:fix-armstrong-logic
Feb 28, 2026
Merged

Fix armstrong logic#3156
geekcomputers merged 2 commits intogeekcomputers:masterfrom
2007aman:fix-armstrong-logic

Conversation

@2007aman
Copy link
Contributor

This PR improves the is_armstrong_number implementation by replacing manual loops with a more Pythonic approach.

Refactored Logic: Replaced the explicit list creation and for loop with a memory-efficient generator expression and the sum() function.

Improved Reusability: Modified the function to return a boolean value instead of printing directly, allowing it to be used as a utility in other modules.

Performance: Reduced the space complexity from O(n) to O(1) (auxiliary space) by avoiding unnecessary list storage.

@geekcomputers geekcomputers merged commit baba341 into geekcomputers:master Feb 28, 2026
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