blob: 2424e913c23428ead8a94a8f166f24755ec4ea9c (
plain)
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
|
Task 1: "Octal Number System
Write a script to print decimal number 0 to 50 in Octal Number System.
For example:
Decimal 0 = Octal 0
Decimal 1 = Octal 1
Decimal 2 = Octal 2
Decimal 3 = Octal 3
Decimal 4 = Octal 4
Decimal 5 = Octal 5
Decimal 6 = Octal 6
Decimal 7 = Octal 7
Decimal 8 = Octal 10
and so on.
"
My notes: Trivial.
Task #2: "Balanced Brackets
Write a script to generate a string with random number of ( and ) brackets. Then make the script validate the string if it has balanced brackets.
For example:
() - OK
(()) - OK
)( - NOT OK
())() - NOT OK
"
My notes: sounds quite easy. Generate is like coin tossing, validator could
either count how many nested brackets we're in, or we could use regex search
and replace to repeatedly delete () pairs of adjacent characters, valid if
we end up with the empty string.
|