We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Lucky Numbers
Lucky Numbers
Sort by
recency
|
73 Discussions
|
Please Login in order to post a comment
why 23 in between 21 and 25 is not lucky number,
as we are getting digit sum 5, and sum of square of digits are 13.
def luckyNumbers(a, b): lucky_nums=[] seq=range(a,b+1) for num in seq: number=num sum=0 sum_sqr=0 while num!=0: remain=num%10 sum+=remain sum_sqr+=(remain**2) num=num//10
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Lucky Numbers Problem Solution
Why not work for number very long in javascript?
Here is Lucky Numbers problem solution in Python Java C++ and C programming - https://programs.programmingoneonone.com/2021/07/hackerrank-lucky-numbers-problem-soluton.html