Open KartikMouli opened 2 weeks ago
@extinctsion i would like to work on it ! can u please add hactoberfest label and assign this issue to me.
@KartikMouli sure, Ill assign this issue to you. Happy coding!
@extinctsion I have created the pull request. Pls review !
Okay. I'll check it in few days. Don't worry
The current implementation of the
lychrel_test
function repeatedly converts numbers to strings for checking if a number is a palindrome and for reversing the digits. These conversions can slow down the program when processing large datasets or iterating over many numbers.Improvement: To improve performance, we can avoid these string conversions and implement direct number reversal and palindrome checks using integer operations. This will reduce the overhead caused by converting numbers back and forth between integers and strings.
Proposed Solution:
Number Reversal
: Implement a number reversal function that uses integer arithmetic to reverse the digits of a number without converting it to a string.Palindrome Check
: Use the same logic as above to check if a number is a palindrome by reversing it as an integer and comparing it to the original number.Benefits:
Improved performance, especially when testing a large range of numbers. Reduced memory usage as we avoid unnecessary string operations.