-
Notifications
You must be signed in to change notification settings - Fork 3
/
array_strings_2.js
61 lines (42 loc) · 1.54 KB
/
array_strings_2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
1. Enter a number. Reverse its first and last digits. Print the new number.
Input: 13
Output: 31
Input: 895796
Output: 695798
---------------
2. Write down a function which will receive 2 arrays of numbers merge them and return second biggest element of merged array.
Input: [1, 3, 6, 8]; [2, 3, 6, 7]
Output: 7
Input [1, 4]; [3, 6]
Output: 4
---------------
3. Write down a function which will receive an array of numbers and remove duplicates from it (using Set)
Input: [1, 3, 5, 2, 5, 2, 6]
Output: [1, 3, 5, 2, 6]
Input: [1, 1, 1, 3]
Output: [1, 3]
---------------
4. Create an implementation of the rotational cipher, also sometimes called the Caesar cipher.
The Caesar cipher is a simple shift cipher that relies on transposing all the letters in the alphabet using an
integer key between 0 and 26. Using a key of 0 or 26 will always yield the same output due to modular arithmetic.
The letter is shifted for as many values as the value of the key.
1. Encode function
Input: abc, 1
Output: bcd
Input: Hello world, 7
Output Olssv dvysk
2. Decode function
Input: Olssv dvysk, 7
Output: Hello world
Input: bcd, 1
Output: abc
---------------
5. Write down a function which will print the number of the rest seconds until the current day's end.
Example: if current time is 23:59:45 function should print 15
Example: if current time is 23:50:45 function should print 555
---------------
6. Write down a function which will print week day based on provided day.
Input: "2019/10/14"
Output: "Monday"
Input: "2014/09/12"
Output: "Friday"