package
0.0.0-20240615115840-a222ecda5fb5
Repository: https://github.com/koykov/algoexpert.io.git
Documentation: pkg.go.dev
# README
Caesar Cipher Encryptor
Category: Strings
Difficulty: Easy
Description
Given a non-empty string of lowercase letters and a non-negative integer representing a key, write a function that returns a new string obtained by shifting every letter in the input string by k positions in the alphabet, where k is the key.
Note that letters should "wrap" around the alphabet; in other words, the
letter z
shifted by one returns the letter a
.
Sample Input
string = "xyz"
key = 2
Sample Output
"zab"
Optimal Space & Time Complexity
O(n) time | O(n) space - where n is the length of the input string