Skip to content

Commit 3aefb4f

Browse files
authored
Merge branch 'master' into lexicographically_equal_or_not
2 parents d7550b6 + b6bab63 commit 3aefb4f

File tree

13 files changed

+649
-27
lines changed

13 files changed

+649
-27
lines changed
File renamed without changes.

10. Caesar Cipher/CaesarCipher.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const allShifts = [...Array(26).keys()]
2+
const cipher = (str, keys=allShifts) => {
3+
const chars = str.split("")
4+
const res = keys.map( key => {
5+
return chars.map( c => {
6+
const char = c.charCodeAt(0)
7+
if(char > 64 && char < 91)
8+
{
9+
return String.fromCharCode(65 + (char + key) % 65 % 26)
10+
}
11+
else if(char > 96 && char < 123)
12+
{
13+
return String.fromCharCode(97 + (char + key) % 97 % 26)
14+
}
15+
else
16+
{
17+
return String.fromCharCode(char)
18+
}
19+
})
20+
})
21+
22+
return res.map( (r, i) => { return { key: keys[i], result: r.join("") } } )
23+
}
File renamed without changes.
File renamed without changes.

Palindrome_5/problem_palindrome.js renamed to 5. Palindrome/problem_palindrome.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Usign First Intuitive Method
12

23
function palindrome_check(text) {
34

@@ -7,4 +8,4 @@ function palindrome_check(text) {
78

89
}
910

10-
palindrome_check("car")
11+
console.log( palindrome_check("car"))
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)