This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
this solution fails for max_n equal to any power of 10.
I have updated the test suite to test for when n = 10 and max_n = 100 and tried to rescore all of them so far.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
n = 1;
max_n = 9;
n_str = '1';
assert(isequal(betterIndexNum(n,max_n),n_str))
|
2 | Pass |
%%
n = 1;
max_n = 28;
n_str = '01';
assert(isequal(betterIndexNum(n,max_n),n_str))
|
3 | Pass |
%%
n = 28;
max_n = 848984;
n_str = '000028';
assert(isequal(betterIndexNum(n,max_n),n_str))
|
4 | Fail |
%%
n = 10;
max_n = 100;
n_str = '010';
assert(isequal(betterIndexNum(n,max_n),n_str))
Error: Assertion failed.
|
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!