+ 8
here is my small challenge :
Write a function that has a self-call, with n receiving an integer greater than 1 and typing all the binary numbers to a length of n from the smallest to the largest except for the numbers with zero consecutive digits For example, if n = 3 is printed: 010 011 101 110 111
11 Answers
+ 5
yes there is no 00
+ 5
there must not be any 00 in output just 11,010,110...etc
+ 5
no once follow the basic condition , you must use self-call method
+ 4
https://code.sololearn.com/cfJZSooz6Co0/?ref=app
My try. Not too shabby I guess...
+ 4
thanks for all but there is no one use recall methods like string a(int x){some code and a(x-1)}
for example
+ 3
Hereâs another version with a recursive method: https://code.sololearn.com/WB6YVa1Q4Re0/?ref=app
+ 2
+ 2
When n = 5, these are invalid, right?
01001
10010
00111
11000
10001
etc...
+ 2
https://code.sololearn.com/cTxG6cjdmuvP/?ref=app
This is my try in C++
@ABADA S
Now inside my function 'calcula(int n)' there is a call to 'calcula(n-1)'.
Thanks for your comments.
And now progressive...
https://code.sololearn.com/chqWQkVWEhqS/?ref=app
+ 1
@ABADA S
Shouldn't the program print 100 and 001 as well?