Cody

Problem 42757. Convert integer to base26 using letters

Solution 2755447

Submitted on 29 Jul 2020 by Nikolaos Nikolaou
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
nums = [0,1,10,25,26,52,100,260]; words = {'a','b','k','z','ba','ca','dw','ka'}; for n=1:length(nums) assert(strcmpi(words{n},dec2alpha(nums(n)))); end

s = 'K' s = 'Z' s = 'dW' s = 'Ka'

2   Pass
nums = [35664,62366]; words = {'cats','dogs'}; for n=1:length(nums) assert(strcmpi(words{n},dec2alpha(nums(n)))); end

s = 'caTI' s = 'caTS' s = 'dOgI' s = 'dOgS'

3   Pass
assert(strcmpi('matlab', dec2alpha(142917893)));

s = 'MaJBab' s = 'MaTBab' s = 'MaTLab'

Suggested Problems

More from this Author2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!