Problem 34. Binary numbers
matlab functions should not be allowed. Let people think of the solution from scratch.
I actually use a function to do this in my project, but my original code scored 47.
I had all the test cases working properly except for n=10!
This is very weird!!
when n = 3;
A = binary_numbers(n);
assert(all(A(:) == 0 | A(:) == 1))
Very fun problem!
More difficult than I expected!
There was a guy who solved this problem with around 11k code size. Absolute madlad.
difficult that I intended it to be.
Solution CommentsShow comments
Problem Recent Solvers3836
Flip the main diagonal of a matrix
Convert given decimal number to binary number.
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!