+ 4
how to write a program for A step Number?
A number for which every pair of consecutive digits has a difference of one is a step number (eg. 456567). Help me generate a good program which gives us step numbers in a range!
7 odpowiedzi
+ 3
Usman Amin here an algorithm that uses binary search: https://code.sololearn.com/c6w2vbHCbmT3/?ref=app
and here the recursive version of it: https://code.sololearn.com/clL9jSzp1m5W/?ref=app
Anna Danke für die Einleitung ;)
+ 3
Edward for sure! but i think first place for zero will be ambiguous!
+ 2
Actually this Q&A isnt the right place to put tasks. Put in your post, but i've done it.
https://code.sololearn.com/cM9M34W61tT4/?ref=app
+ 2
ShortCode I've changed it to question! your code is not working for me!
it also gives Wrong output!
input 55
output true
which is false
this has problem in double numbers
+ 2
Great efforts All of you Nice Guys! Thanks for your time and creations!
+ 1
I have written the code to check for one number. All it does is to check if every digit is one less or one more than the last.
https://code.sololearn.com/cBjbx3Nc7Jsi/?ref=app
+ 1
Usman Amin i was thinking, if we can consider zero and nine as adjacent numbers. like, is 89012 a step member as well? this would open a whole new series of possibilities...