Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = 3276;
y_correct = 5;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
7 6 3 2
y =
7632
DSorted =
2 3 6 7
y =
2367
x =
5265
DSorted =
6 5 5 2
y =
6552
DSorted =
2 5 5 6
y =
2556
x =
3996
DSorted =
9 9 6 3
y =
9963
DSorted =
3 6 9 9
y =
3699
x =
6264
DSorted =
6 6 4 2
y =
6642
DSorted =
2 4 6 6
y =
2466
x =
4176
DSorted =
7 6 4 1
y =
7641
DSorted =
1 4 6 7
y =
1467
x =
6174
|
2 | Pass |
x = 3;
y_correct = 6;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
3 0 0 0
y =
3000
DSorted =
0 0 0 3
y =
3
x =
2997
DSorted =
9 9 7 2
y =
9972
DSorted =
2 7 9 9
y =
2799
x =
7173
DSorted =
7 7 3 1
y =
7731
DSorted =
1 3 7 7
y =
1377
x =
6354
DSorted =
6 5 4 3
y =
6543
DSorted =
3 4 5 6
y =
3456
x =
3087
DSorted =
8 7 3 0
y =
8730
DSorted =
0 3 7 8
y =
378
x =
8352
DSorted =
8 5 3 2
y =
8532
DSorted =
2 3 5 8
y =
2358
x =
6174
|
3 | Pass |
x = 691;
y_correct = 7;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
9 6 1 0
y =
9610
DSorted =
0 1 6 9
y =
169
x =
9441
DSorted =
9 4 4 1
y =
9441
DSorted =
1 4 4 9
y =
1449
x =
7992
DSorted =
9 9 7 2
y =
9972
DSorted =
2 7 9 9
y =
2799
x =
7173
DSorted =
7 7 3 1
y =
7731
DSorted =
1 3 7 7
y =
1377
x =
6354
DSorted =
6 5 4 3
y =
6543
DSorted =
3 4 5 6
y =
3456
x =
3087
DSorted =
8 7 3 0
y =
8730
DSorted =
0 3 7 8
y =
378
x =
8352
DSorted =
8 5 3 2
y =
8532
DSorted =
2 3 5 8
y =
2358
x =
6174
|
4 | Pass |
x = 3333;
y_correct = Inf;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
3 3 3 3
y =
3333
DSorted =
3 3 3 3
y =
3333
x =
0
y =
Inf
|
5 | Pass |
x = 1;
y_correct = 5;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
1 0 0 0
y =
1000
DSorted =
0 0 0 1
y =
1
x =
999
DSorted =
9 9 9 0
y =
9990
DSorted =
0 9 9 9
y =
999
x =
8991
DSorted =
9 9 8 1
y =
9981
DSorted =
1 8 9 9
y =
1899
x =
8082
DSorted =
8 8 2 0
y =
8820
DSorted =
0 2 8 8
y =
288
x =
8532
DSorted =
8 5 3 2
y =
8532
DSorted =
2 3 5 8
y =
2358
x =
6174
|
6 | Pass |
x = 6174;
y_correct = 0;
assert(isequal(KaprekarSteps(x),y_correct))
|
7 | Pass |
x = 1234;
y_correct = 3;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
4 3 2 1
y =
4321
DSorted =
1 2 3 4
y =
1234
x =
3087
DSorted =
8 7 3 0
y =
8730
DSorted =
0 3 7 8
y =
378
x =
8352
DSorted =
8 5 3 2
y =
8532
DSorted =
2 3 5 8
y =
2358
x =
6174
|
8 | Pass |
x = 3141;
y_correct = 5;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
4 3 1 1
y =
4311
DSorted =
1 1 3 4
y =
1134
x =
3177
DSorted =
7 7 3 1
y =
7731
DSorted =
1 3 7 7
y =
1377
x =
6354
DSorted =
6 5 4 3
y =
6543
DSorted =
3 4 5 6
y =
3456
x =
3087
DSorted =
8 7 3 0
y =
8730
DSorted =
0 3 7 8
y =
378
x =
8352
DSorted =
8 5 3 2
y =
8532
DSorted =
2 3 5 8
y =
2358
x =
6174
|
9 | Pass |
x = 8080;
y_correct = 6;
assert(isequal(KaprekarSteps(x),y_correct))
DSorted =
8 8 0 0
y =
8800
DSorted =
0 0 8 8
y =
88
x =
8712
DSorted =
8 7 2 1
y =
8721
DSorted =
1 2 7 8
y =
1278
x =
7443
DSorted =
7 4 4 3
y =
7443
DSorted =
3 4 4 7
y =
3447
x =
3996
DSorted =
9 9 6 3
y =
9963
DSorted =
3 6 9 9
y =
3699
x =
6264
DSorted =
6 6 4 2
y =
6642
DSorted =
2 4 6 6
y =
2466
x =
4176
DSorted =
7 6 4 1
y =
7641
DSorted =
1 4 6 7
y =
1467
x =
6174
|
Remove the polynomials that have positive real elements of their roots.
447 Solvers
Calculate the Levenshtein distance between two strings
303 Solvers
All your base are belong to us
425 Solvers
Rounding off numbers to n decimals
281 Solvers
255 Solvers