You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* JavaScript Algorithms and Data Structures Projects: Caesars Cipher
3
+
*
4
+
* One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount.
5
+
*
6
+
* A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.
7
+
*
8
+
* Write a function which takes a ROT13 encoded string as input and returns a decoded string.
9
+
*
10
+
* All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.
* Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
4
+
*
5
+
* Symbol Value
6
+
* I 1
7
+
* V 5
8
+
* X 10
9
+
* L 50
10
+
* C 100
11
+
* D 500
12
+
* M 1000
13
+
*
14
+
* For example, two is written as II in Roman numeral, just two one's added together. Twelve is written as, XII, which is simply X + II. The number twenty seven is written as XXVII, which is XX + V + II.
15
+
*
16
+
* Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used:
17
+
*
18
+
* I can be placed before V (5) and X (10) to make 4 and 9.
19
+
* X can be placed before L (50) and C (100) to make 40 and 90.
20
+
* C can be placed before D (500) and M (1000) to make 400 and 900.
21
+
*
22
+
* Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.
23
+
*
24
+
* Example 1:
25
+
*
26
+
* Input: 3
27
+
* Output: "III"
28
+
*
29
+
* Example 2:
30
+
*
31
+
* Input: 4
32
+
* Output: "IV"
33
+
*
34
+
* Example 3:
35
+
*
36
+
* Input: 9
37
+
* Output: "IX"
38
+
*
39
+
* Example 4:
40
+
*
41
+
* Input: 58
42
+
* Output: "LVIII"
43
+
* Explanation: L = 50, V = 5, III = 3.
44
+
*
45
+
* Example 5:
46
+
*
47
+
* Input: 1994
48
+
* Output: "MCMXCIV"
49
+
* Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.
* Determine whether a generated string of brackets is balanced; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest.
0 commit comments