+ 16
๐ [M๐ Challenge] Odven Number ๐ข
Monday Blue ๐ Challenge Series #4 Let's play with numbers again! An "odven" number is a number that starts with an odd digit and alternating between even and odd digits subsequently. (e.g 123) ๐ผ TASK Write a program to accept an integer determine whether it's an odven number. If it's not, display the next odven number. ๐ง TEST CASE โ 123 โ 1234 โ 1496 โ 3030 โ 5298 โ 72727 โ 234 โถ 301 โ 2345 โถ 3010 โ 3239 โถ 3250 โ 5005 โถ 5010 โค BONUS Creative and clear-cut approach is encouraged. Happy Coding!!! ๐๐ป
41 Rรฉponses
+ 13
my code.. ๐
https://code.sololearn.com/c6PfKv23OCfP/?ref=app
+ 16
* My try in Ruby:
https://code.sololearn.com/cLAni25tH6nY/#rb
Nice Challenge, thanks!
PS:
* Refactored code: added some OOP and now met new specs
* Any feedback will be very appreciated! :)
+ 13
My try, Zephyr how'd I do
https://code.sololearn.com/c69Bl4Lei11D/?ref=app
+ 9
@Vengat Yup you've done a pretty good job in such a short time!
Anyway please improve the algorithm to fix the bug for 3239. ๐
+ 9
Thanks everyone for your participation! I'm having a hard time to pick the best answer again as I've observed a few submissions with clean and terse code.
Anyway hope you all enjoy and let's move on to the next challenge! โค
https://www.sololearn.com/Discuss/790138/?ref=app
+ 9
thanks @Zephyr Koo for choosing my code as best.. โ๐
+ 8
https://code.sololearn.com/cQ1oXNWV9EIa/?ref=app
+ 8
https://code.sololearn.com/cef5yyU2BM6R/#cpp
My Solution in C++
Probably getting updated soon...
+ 8
My answer DOES NOT try every number begin from the gaven to achive an odven.It is FAST.
And it support infinite BIG number.Try something like 9999999999999999...
https://code.sololearn.com/cnXk98811RBl/#cpp
+ 7
@Vengat Sorry I've amended my challenge to take it to the next level! ๐
+ 7
@sayan chandra Odven number requires alternating odd and even digits. ๐
+ 7
came guys
my try bit unique
https://code.sololearn.com/cJizMc9g3353/?ref=app
+ 6
Decided I had enough of one-liners
+ 6
@Vengat One-liner is fine as long as it's comprehensible. ๐
+ 6
@sayan Not really. I just updated the test cases with next Odven numbers only. ๐
+ 6
So Zephyr mine works?
+ 6
Here's mine in C#.
https://code.sololearn.com/ccUhRQ3DSKxs/#cs
+ 6
Oh yeah