Cody

Problem 1201. Simple Decoder Ring

Solution 2265121

Submitted on 8 May 2020 by Joshua Sonn
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
inString1 = 'I am ready to try it - with punctuation and CAPS!'; outString1a = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'; assert(isequal(simpleDecoderRing(inString1,-3),outString1a ));

stringers = 'i am ready to try it - with punctuation and caps!' A = 1×49 uint16 row vector Columns 1 through 30 73 32 97 109 32 114 101 97 100 121 32 116 111 32 116 114 121 32 105 116 32 45 32 119 105 116 104 32 112 117 Columns 31 through 49 110 99 116 117 97 116 105 111 110 32 97 110 100 32 67 65 80 83 33 B = 1×49 uint16 row vector Columns 1 through 30 105 32 97 109 32 114 101 97 100 121 32 116 111 32 116 114 121 32 105 116 32 45 32 119 105 116 104 32 112 117 Columns 31 through 49 110 99 116 117 97 116 105 111 110 32 97 110 100 32 99 97 112 115 33

2   Pass
inString1 = 'I am ready to try it - with punctuation and CAPS!'; outString1b = 'L dp uhdgb wr wub lw - zlwk sxqfwxdwlrq dqg FDSV!'; assert(isequal(simpleDecoderRing(inString1,3),outString1b ));

stringers = 'i am ready to try it - with punctuation and caps!' A = 1×49 uint16 row vector Columns 1 through 30 73 32 97 109 32 114 101 97 100 121 32 116 111 32 116 114 121 32 105 116 32 45 32 119 105 116 104 32 112 117 Columns 31 through 49 110 99 116 117 97 116 105 111 110 32 97 110 100 32 67 65 80 83 33 B = 1×49 uint16 row vector Columns 1 through 30 105 32 97 109 32 114 101 97 100 121 32 116 111 32 116 114 121 32 105 116 32 45 32 119 105 116 104 32 112 117 Columns 31 through 49 110 99 116 117 97 116 105 111 110 32 97 110 100 32 99 97 112 115 33

3   Pass
inString2 = 'Dick Tracy is often associated with decoder rings.'; outString2a = 'Lqks Bzikg qa wnbmv iaawkqibml eqbp lmkwlmz zqvoa.'; assert(isequal(simpleDecoderRing(inString2,-18),outString2a ));

stringers = 'dick tracy is often associated with decoder rings.' A = 1×50 uint16 row vector Columns 1 through 30 68 105 99 107 32 84 114 97 99 121 32 105 115 32 111 102 116 101 110 32 97 115 115 111 99 105 97 116 101 100 Columns 31 through 50 32 119 105 116 104 32 100 101 99 111 100 101 114 32 114 105 110 103 115 46 B = 1×50 uint16 row vector Columns 1 through 30 100 105 99 107 32 116 114 97 99 121 32 105 115 32 111 102 116 101 110 32 97 115 115 111 99 105 97 116 101 100 Columns 31 through 50 32 119 105 116 104 32 100 101 99 111 100 101 114 32 114 105 110 103 115 46

4   Pass
inString2 = 'Dick Tracy is often associated with decoder rings.'; outString2b = 'Zeyg Pnwyu eo kbpaj wookyewpaz sepd zaykzan nejco.'; assert(isequal(simpleDecoderRing(inString2,22),outString2b ));

stringers = 'dick tracy is often associated with decoder rings.' A = 1×50 uint16 row vector Columns 1 through 30 68 105 99 107 32 84 114 97 99 121 32 105 115 32 111 102 116 101 110 32 97 115 115 111 99 105 97 116 101 100 Columns 31 through 50 32 119 105 116 104 32 100 101 99 111 100 101 114 32 114 105 110 103 115 46 B = 1×50 uint16 row vector Columns 1 through 30 100 105 99 107 32 116 114 97 99 121 32 105 115 32 111 102 116 101 110 32 97 115 115 111 99 105 97 116 101 100 Columns 31 through 50 32 119 105 116 104 32 100 101 99 111 100 101 114 32 114 105 110 103 115 46

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!