Cody

Problem 751. Implement simple rotation cypher

Solution 2645234

Submitted on 2 Jul 2020
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   Fail
inStr = 'doug'; shift = 10; outStr = 'nyeq'; assert(isequal(cypher(inStr, shift),outStr))

idx = 1×26 logical array 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Unrecognized function or variable 'alphs'. Error in cypher (line 10) inStr(i)=alphs(idx) Error in Test1 (line 5) assert(isequal(cypher(inStr, shift),outStr))

2   Fail
inStr = 'thequickbrownfox'; shift = 5; outStr = 'ymjvznhpgwtbsktc'; assert(isequal(cypher(inStr, shift),outStr))

idx = 1×26 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0

Unrecognized function or variable 'alphs'. Error in cypher (line 10) inStr(i)=alphs(idx) Error in Test2 (line 5) assert(isequal(cypher(inStr, shift),outStr))

3   Fail
inStr = 'thecrowfliesatmidnight'; shift = 22; outStr = 'pdaynksbheaowpiezjecdp'; assert(isequal(cypher(inStr, shift),outStr))

idx = 1×26 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0

Unrecognized function or variable 'alphs'. Error in cypher (line 10) inStr(i)=alphs(idx) Error in Test3 (line 5) assert(isequal(cypher(inStr, shift),outStr))