Cody

# Problem 68. Kaprekar Steps

Solution 1766311

Submitted on 29 Mar 2019 by Andreas Berg
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 3276; y_correct = 5; assert(isequal(KaprekarSteps(x),y_correct))

s = '0002367' s = '0002556' s = '0003699' s = '0002466' s = '0001467'

2   Pass
x = 3; y_correct = 6; assert(isequal(KaprekarSteps(x),y_correct))

s = '0003' s = '0002799' s = '0001377' s = '0003456' s = '0000378' s = '0002358'

3   Pass
x = 691; y_correct = 7; assert(isequal(KaprekarSteps(x),y_correct))

s = '000169' s = '0001449' s = '0002799' s = '0001377' s = '0003456' s = '0000378' s = '0002358'

4   Pass
x = 3333; y_correct = Inf; assert(isequal(KaprekarSteps(x),y_correct))

s = '0003333'

5   Pass
x = 1; y_correct = 5; assert(isequal(KaprekarSteps(x),y_correct))

s = '0001' s = '000999' s = '0001899' s = '0000288' s = '0002358'

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))

s = '0001234' s = '0000378' s = '0002358'

8   Pass
x = 3141; y_correct = 5; assert(isequal(KaprekarSteps(x),y_correct))

s = '0001134' s = '0001377' s = '0003456' s = '0000378' s = '0002358'

9   Pass
x = 8080; y_correct = 6; assert(isequal(KaprekarSteps(x),y_correct))

s = '0000088' s = '0001278' s = '0003447' s = '0003699' s = '0002466' s = '0001467'