aboutsummaryrefslogtreecommitdiff
path: root/challenge-019
diff options
context:
space:
mode:
authorJaime <42359730+bracteatus@users.noreply.github.com>2019-08-01 09:04:32 -0600
committerJaime <42359730+bracteatus@users.noreply.github.com>2019-08-01 09:04:32 -0600
commit1e6c14f2f8739e1c4c6e2a9a1419fa4b890e2135 (patch)
tree374f13580374edac60379a8f0995786474531bb6 /challenge-019
parent145f59407ae78145d6d16d05cb6039ca05e11f44 (diff)
downloadperlweeklychallenge-club-1e6c14f2f8739e1c4c6e2a9a1419fa4b890e2135.tar.gz
perlweeklychallenge-club-1e6c14f2f8739e1c4c6e2a9a1419fa4b890e2135.tar.bz2
perlweeklychallenge-club-1e6c14f2f8739e1c4c6e2a9a1419fa4b890e2135.zip
Update README with tasks.
Diffstat (limited to 'challenge-019')
-rw-r--r--challenge-019/jaime/README80
1 files changed, 38 insertions, 42 deletions
diff --git a/challenge-019/jaime/README b/challenge-019/jaime/README
index c1fbac90da..b21b4c4f42 100644
--- a/challenge-019/jaime/README
+++ b/challenge-019/jaime/README
@@ -1,42 +1,38 @@
-# Challenge #1
-
-Write a script that takes 2 or more strings as command line parameters
-and print the longest common substring. For example, the longest
-common substring of the strings “ABABC”, “BABCA” and “ABCBA” is string
-“ABC” of length 3. Other common substrings are “A”, “AB”, “B”, “BA”,
-“BC” and “C”.
-
-## Solution
-
-Substrings of the first argument are iterated by decreasing length.
-
-The script finds the `$substring` that is common within the list of
-parameters `@ARGV == grep(/$substring/,@ARGV)`.
-
-# Challenge #2
-
-Write a script to implement Priority Queue. It is like regular queue
-except each element has a priority associated with it. In a priority
-queue, an element with high priority is served before an element with
-low priority. Please check this wiki page for more informations. It
-should serve the following operations:
-
-1. `is_empty`: check whether the queue has no elements.
-
-2. `insert_with_priority`: add an element to the queue with an
-associated priority.
-
-3. `pull_highest_priority_element`: remove the element from the queue
-that has the highest priority, and return it. If two elements have the
-same priority, then return element added first.
-
-## Solution
-
-The solution is a hashmap of priority and anonymous arrays.
-
-The anonymous array `[]` is accessed with a `$priority`.
-`$queue` is the hashmap. `$queue->{$priority}` is an anonymous array.
-`@{$queue->{$priority}}` wraps access to the prioritized queues as arrays.
-
-`pull_highest_priority_element()` parses the `$queue` to find the
-nonempty array with the largest priority, then returns the first entry.
+# Task #1
+
+Write a script to display months from the year 1900 to 2019 where you
+find 5 weekends i.e. 5 Friday, 5 Saturday and 5 Sunday.
+
+# Task #2
+
+Write a script that can wrap the given paragraph at a specified column
+using the greedy algorithm.
+
+A simple way to do word wrapping is to use a greedy algorithm that
+puts as many words on a line as possible, then moving on to the next
+line to do the same until there are no more words left to place. This
+method is used by many modern word processors, such as OpenOffice.org
+Writer and Microsoft Word[citation needed]. This algorithm always uses
+the minimum possible number of lines but may lead to lines of widely
+varying lengths. The following pseudocode implements this algorithm:
+
+```
+SpaceLeft := LineWidth
+for each Word in Text
+ if (Width(Word) + SpaceWidth) > SpaceLeft
+ insert line break before Word in Text
+ SpaceLeft := LineWidth - Width(Word)
+ else
+ SpaceLeft := SpaceLeft - (Width(Word) + SpaceWidth)
+```
+
+Where LineWidth is the width of a line, SpaceLeft is the remaining
+width of space on the line to fill, SpaceWidth is the width of a
+single space character, Text is the input text to iterate over and
+Word is a word in this text.
+
+# Task #3 (Optional)
+
+Write a script to use NYT Books API. You can get API key here. For
+more information about API, please visit page. The API task is
+optional but we would love to see your solution.