aboutsummaryrefslogtreecommitdiff
path: root/challenge-064/duncan-c-white/README
blob: 9df57b02da153289351440723f0a6fa27a5fb4d8 (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
Task 1: "Minimum Sum Path

Given an MxN matrix with non-negative integers, write a script to find
a path from top left to bottom right which minimizes the sum of all
numbers along its path. You can only move either down or right at any
point in time.

Example

Input:

[ 1 2 3 ]
[ 4 5 6 ]
[ 7 8 9 ]

The minimum sum path looks like this:

1->2->3
      |
      6
      |
      9

Thus, your script could output: 21 ( 1 -> 2 -> 3 -> 6 -> 9 )
"

My notes: sounds like fun.


Task 2: "Word Break

You are given a string $S and an array of words @W.

Write a script to find out if $S can be split into sequence of one
or more words as in the given @W.  Print all the words if found
otherwise print 0.

Example 1:

Input:

$S = "perlweeklychallenge"
@W = ("weekly", "challenge", "perl")

Output:

"perl", "weekly", "challenge"

Example 2:

Input:

$S = "perlandraku"
@W = ("python", "ruby", "haskell")

Output:

0 as none matching word found.
"

My notes: sounds like fun.  Nice question.