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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# Solutions by Packy Anderson
## Raku
* [Task 1](raku/ch-1.raku)
Sample output
```
$ raku/ch-1.raku
Example 1:
Input: $str = "loveleetcode", $char = "e"
Output: (3,2,1,0,1,0,0,1,2,2,1,0)
Example 2:
Input: $str = "aaab", $char = "b"
Output: (3,2,1,0)
```
* [Task 2](raku/ch-2.raku)
Sample output
```
$ raku/ch-2.raku
Example 1:
Input: $a = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
Output: $b = [
[14, 18, 22],
[30, 34, 38]
]
Example 2:
Input: $a = [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
]
Output: $b = [
[2, 1, 0],
[1, 2, 1],
[0, 1, 2]
]
```
## Perl
* [Task 1](perl/ch-1.pl)
Sample output
```
$ perl/ch-1.pl
Example 1:
Input: $str = "loveleetcode", $char = "e"
Output: (3,2,1,0,1,0,0,1,2,2,1,0)
Example 2:
Input: $str = "aaab", $char = "b"
Output: (3,2,1,0)
```
* [Task 2](perl/ch-2.pl)
Sample output
```
$ perl/ch-2.pl
Example 1:
Input: $a = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
Output: $b = [
[14, 18, 22],
[30, 34, 38]
]
Example 2:
Input: $a = [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
]
Output: $b = [
[2, 1, 0],
[1, 2, 1],
[0, 1, 2]
]
```
## Guest Language: Python
* [Task 1](python/ch-1.py)
* [Task 2](python/ch-2.py)
## Blog Post
[Perl Weekly Challenge: The Shortest Distance between Submatrix Sums](https://packy.dardan.com/b/Ff)
|