🔥🔥🔥 hard challenge() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

🔥🔥🔥 hard challenge()

Find the smallest Number such that if it's RIGHTMOST digit is placed at the BEGINNING, The new Number so formed is precisely 50% larger than the original Number? Hint: use a C# or any other program to find the correct answer or the longer trial and error method. ...good luck!

13th Jul 2017, 6:59 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
9 Answers
+ 8
https://code.sololearn.com/cpmuEsS2VfMY/#py Run the code to find the answer :D
13th Jul 2017, 7:41 AM
Sheena Singh
Sheena Singh - avatar
+ 10
I'm late 😞. Here's a JS solution 🙋. https://code.sololearn.com/WO3Co0TYK73y/?ref=app
13th Jul 2017, 9:28 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 8
That's awesome @Visph.
13th Jul 2017, 9:11 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 7
@Sheena Singh: Much efficient way to do: n = 10 m = 0 while int(m) != 1.5 * n: n += 1 m = str(n%10)+str(n//10) print(n)
13th Jul 2017, 8:13 AM
visph
visph - avatar
+ 5
@Nomeh Uchenna Gabriel wrote: << That's awesome @Visph. >> Awesome but not 'best answer'? ;P
13th Jul 2017, 10:19 AM
visph
visph - avatar
+ 5
@Krishna ~Wow 👏👏👏, this is too great! I never thought of the harder JavaScript version.
13th Jul 2017, 11:08 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 3
@Baptiste: But more verbose ^^ (even if mine should probably been improved ;))
13th Jul 2017, 12:44 PM
visph
visph - avatar
0
@visph Even more efficient (no str/int) n=10 m=0 dec=10 while (n%10*dec+n//10)!=1.5*n: n+=1 if n>=dec*10: dec*=10 print(n)
13th Jul 2017, 12:41 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
@visph Yes of course more verbose, but as we do not convert integer to strings each time, it stays more efficient ^^ I did not manage to make it less verbose without passing the number to string as you did
13th Jul 2017, 12:46 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar