A Caesar cipher shifts every letter forward through the alphabet by a fixed amount, wrapping around from z back to a.
Given a lowercase string s and a whole number n, return the encoded string where each letter is shifted forward by n positions. The shift may be larger than 26, and wrapping must work correctly (shifting z by 1 gives a).
Examples:
s = 'abc', n = 1 -> 'bcd'
s = 'xyz', n = 3 -> 'abc'
s = 'hello', n = 13 -> 'uryyb'

Solution Stats

10 Solutions

7 Solvers

Last Solution submitted on Jul 12, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers7

Suggested Problems

More from this Author1

Problem Tags

Community Treasure Hunt

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

Start Hunting!