Skip to content

Comments

Fix armstrong logic#3156

Open
2007aman wants to merge 2 commits intogeekcomputers:masterfrom
2007aman:fix-armstrong-logic
Open

Fix armstrong logic#3156
2007aman wants to merge 2 commits intogeekcomputers:masterfrom
2007aman:fix-armstrong-logic

Conversation

@2007aman
Copy link

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.

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.

1 participant