Posts

Showing posts from August, 2025

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #333 (“Straight Line” and “Duplicate Zeros”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-08-04 through 2025-08-10 is #333 The tasks for challenge #333 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 333-1: Straight Line Submitted by: Mohammad Sajid Anwar You are given a list of co-ordinates. Write a script to find out if the given points make a straight line. Example 1 Input: @list = ([2, 1], [2, 3], [2, 5]) Output: true Example 2 Input: @list = ([1, 4], [3, 4], [10, 4]) Output: true Example 3 Input: @list = ([0, 0], [1, 1], [2, 3]) Output: false Example 4 Input: @list = ([1, 1], [1, 1], [1, 1]) Output: true Example 5 Input: @list = ([1000000, 1000000], [2000000, 2000000], [3000000, 3000000]) Output: true I'll consider points A, B, C to be collinear if...