Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 782f3d0

Browse files
Created: **Caesar's Cipher/README.md**
1 parent ea76ac4 commit 782f3d0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

‎L-A/0013 Caesar's Cipher/README.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Caesar's Cipher
2+
[Edabit Problem](https://edabit.com/challenge/a33jdGXkaQRtK9ZTs)
3+
4+
Julius Caesar protected his confidential information by encrypting it using a cipher. Caesar's cipher (check ***Resources*** tab for more info) shifts each letter by a number of letters. If the shift takes you past the end of the alphabet, just rotate back to the front of the alphabet. In the case of a rotation by *3, w, x, y* and *z* would map to *z, a, b* and *c*.
5+
6+
Create a function that takes a string *s* (text to be encrypted) and an integer *k* (the rotation factor). It should return an encrypted string.
7+
8+
## Example:
9+
```javascript
10+
caesarCipher("middle-Outz", 2) ➞ "okffng-Qwvb"
11+
12+
// m -> o
13+
// i -> k
14+
// d -> f
15+
// d -> f
16+
// l -> n
17+
// e -> g
18+
// - -
19+
// O -> Q
20+
// u -> w
21+
// t -> v
22+
// z -> b
23+
24+
caesarCipher("Always-Look-on-the-Bright-Side-of-Life", 5)
25+
"Fqbfdx-Qttp-ts-ymj-Gwnlmy-Xnij-tk-Qnkj"
26+
27+
caesarCipher("A friend in need is a friend indeed", 20)
28+
"U zlcyhx ch hyyx cm u zlcyhx chxyyx"
29+
```
30+
31+
### Notes: All test input will be a valid ASCII string.
32+
33+
## By: arindal1
34+
***[GitHub](https://github.com/arindal1)***

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /