diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2021-05-17 06:57:07 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2021-05-17 06:57:07 +0100 |
| commit | c3cd45087006d3f63b05219b8280a25dc1ea7ba9 (patch) | |
| tree | ebd94e12f33bd5860791fb2d7ac49d4074c989f3 /challenge-113/duncan-c-white/README | |
| parent | b848049a94b216d459403b8590b26ec59e5746fd (diff) | |
| download | perlweeklychallenge-club-c3cd45087006d3f63b05219b8280a25dc1ea7ba9.tar.gz perlweeklychallenge-club-c3cd45087006d3f63b05219b8280a25dc1ea7ba9.tar.bz2 perlweeklychallenge-club-c3cd45087006d3f63b05219b8280a25dc1ea7ba9.zip | |
- Added template for week 113.
Diffstat (limited to 'challenge-113/duncan-c-white/README')
| -rw-r--r-- | challenge-113/duncan-c-white/README | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/challenge-113/duncan-c-white/README b/challenge-113/duncan-c-white/README new file mode 100644 index 0000000000..0efdd3eeaa --- /dev/null +++ b/challenge-113/duncan-c-white/README @@ -0,0 +1,63 @@ +Task 1: "Canonical Path + +You are given a string path, starting with a slash '/'. + +Write a script to convert the given absolute path to the simplified canonical path. + +In a Unix-style file system: + +- A period '.' refers to the current directory +- A double period '..' refers to the directory up a level +- Multiple consecutive slashes ('//') are treated as a single slash '/' + +The canonical path format: + +- The path starts with a single slash '/'. +- Any two directories are separated by a single slash '/'. +- The path does not end with a trailing '/'. +- The path only contains the directories on the path from the root + directory to the target file or directory + +Example + +Input: "/a/" +Output: "/a" + +Input: "/a/b//c/" +Output: "/a/b/c" + +Input: "/a/b/c/../.." +Output: "/a" +" + +My notes: ok, I like this. Pretty straightforward, but a nice practical problem. + + +Task 2: "Climb Stairs + +You are given $n steps to climb + +Write a script to find out the distinct ways to climb to the top. You +are allowed to climb either 1 or 2 steps at a time. + +Example + +Input: $n = 3 +Output: 3 + + Option 1: 1 step + 1 step + 1 step + Option 2: 1 step + 2 steps + Option 3: 2 steps + 1 step + +Input: $n = 4 +Output: 5 + + Option 1: 1 step + 1 step + 1 step + 1 step + Option 2: 1 step + 1 step + 2 steps + Option 3: 2 steps + 1 step + 1 step + Option 4: 1 step + 2 steps + 1 step + Option 5: 2 steps + 2 steps +" + +My notes: looks pretty straightforward, although may not generate the options +in the same order. |
