Cody

Problem 1953. Simple Caesar Cypher - shift encrypt a message given an index number

Solution 1124641

Submitted on 16 Feb 2017 by Jihye Sofia Seo
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
message = 'elephant'; shift = 45; correct = 'xexiatgm'; assert(isequal(caesarShift(message,shift),correct))

s1 = elephant f = 19 addLoc = 1 3 6 subLoc = 2 4 5 7 8

2   Pass
message = 'TiGEr'; shift = -537; answer = 'crpna'; assert(isequal(caesarShift(message,shift),answer))

s1 = tiger f = 9 addLoc = 2 3 4 subLoc = 1 5

3   Pass
message = 'gozoaobrsf' shift = 12; answer = 'salamander'; assert(isequal(caesarShift(message,shift),answer))

message = gozoaobrsf s1 = gozoaobrsf f = 12 addLoc = 1 5 7 10 subLoc = 2 3 4 6 8 9

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!