Posts

Showing posts from September, 2024

Robbie Hatley's Solutions To The Weekly Challenge #286

For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, cycling every Sunday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2024-09-08 through 2024-09-14 is #286. Its tasks are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 286-1: "Self Spammer" Submitted by: David Ferrone Write a program which outputs one word of its own script source code at random. A word is anything between whitespace, including symbols. Example 1: If the source code contains a line such as: 'open my $fh, "<", "ch-1.pl" or die;' then the program would output each of the words { open, my, $fh,, "<",, "ch-1.pl", or, die; } (along with other words in the source) with some positive probability. Example 2: Technically 'print(" hello ");' is *not* an example program, because it does not assign positive proba

Robbie Hatley's Solutions To The Weekly Challenge #285

For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, cycling every Sunday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2024-09-01 through 2024-09-07 is #285. Its tasks are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 285-1: "No Connection" Submitted by: Mohammad Sajid Anwar You are given a list of routes, @routes. Write a script to find the destination with no further outgoing connection. Example 1: Input: @routes = (["B","C"], ["D","B"], ["C","A"]) Output: "A" "D" -> "B" -> "C" -> "A". "B" -> "C" -> "A". "C" -> "A". "A". Example 2: Input: @routes = (["A","Z"]) Output: "Z" This is just a matter of checking for end destina