aboutsummaryrefslogtreecommitdiff
path: root/challenge-091/abigail/README.md
blob: 525fe7067b8b74a74c8d97d7c1849957d91afef0 (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
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
62
63
64
65
Solution by Abigail

# Task 1: Count Number

You are given a positive number `$N`.

Write a script to count number and display as you read it.

### Example 1:

    Input: $N = 1122234
    Output: 21321314

as we read "two 1 three 2 one 3 one 4"

### Example 2:

    Input: $N = 2333445
    Output: 12332415

as we read "one 2 three 3 two 4 one 5"

### Example 3:

    Input: $N = 12345
    Output: 1112131415

as we read "one 1 one 2 one 3 one 4 one 5"

## Solutions
* [Perl](perl/ch-1.pl).

[Blog post](https://wp.me/pcxd30-j2).

# Task 2: Jump Game

You are given an array of positive numbers @N, where value at each
index determines how far you are allowed to jump further.

Write a script to decide if you can jump to the last index. Print
1 if you are able to reach the last index otherwise 0.

### Example 1:

    Input: @N = (1, 2, 1, 2)
    Output: 1

as we jump one place from index 0 and then twoe places from index
1 to reach the last index.

### Example 2:

    Input: @N = (2,1,1,0,2)
    Output: 0

it is impossible to reach the last index. as we jump two places
from index 0 to reach index 2, followed by one place jump from index
2 to reach the index 3. once you reached the index 3, you can't go
any further because you can only jump 0 position further.


## Solutions
* [Perl](perl/ch-2.pl).

[Blog post](https://wp.me/pcxd30-jq).