Skip to content

Instantly share code, notes, and snippets.

@manwar
Last active May 8, 2026 22:41
Show Gist options
  • Select an option

  • Save manwar/4259216ed01dcd899cc06d1abdb6c303 to your computer and use it in GitHub Desktop.

Select an option

Save manwar/4259216ed01dcd899cc06d1abdb6c303 to your computer and use it in GitHub Desktop.
The Weekly Challenge - 373

The Weekly Challenge - 373

Early Bird Club members ONLY

Task 1: Equal List

Submitted by: Mohammad Sajid Anwar

You are given two arrays of strings.

Write a script to return true if the two given array represent the same strings otherwise false.

Example 1

Input: @arr1 = ("a", "bc")
       @arr2 = ("ab", "c")
Output: true

Array 1: "a" + "bc" = "abc"
Array 2: "ab" + "c" = "abc"

Example 2

Input: @arr1 = ("a", "b", "c")
       @arr2 = ("a", "bc")
Output: true

Array 1: "a" + "b" + "c" = "abc"
Array 2: "a" + "bc" = "abc"

Example 3

Input: @arr1 = ("a", "bc")
       @arr2 = ("a", "c", "b")
Output: false

Array 1: "a" + "bc" = "abc"
Array 2: "a" + "c" + "b" = "acb"

Example 4

Input: @arr1 = ("ab", "c", "")
       @arr2 = ("", "a", "bc")
Output: true

Array 1: "ab" + "c" + "" = "abc"
Array 2: ""  + "a" + "bc" = "abc"

Example 5

Input: @arr1 = ("p", "e", "r", "l")
       @arr2 = ("perl")
Output: true

Array 1: "p" + "e" + "r" + "l" = "perl"
Array 2: "perl"

Task 2: List Division

Submitted by: Mark Anderson

You are given a list and a non-negative integer.

Write a script to divide the given list into given non-negative integer equal parts. Return -1 if the integer is more than the size of the list.

Example 1

Input: @list = (1,2,3,4,5), $n = 2
Output: ((1,2,3), (4,5))

5 / 2 = 2 remainder 1.
The extra element goes into the first chunk.

Example 2

Input: @list = (1,2,3,4,5,6), $n = 3
Output: ((1,2), (3,4), (5,6))

6 / 3 = 2 remainder 0.

Example 3

Input: @list = (1,2,3), $n = 2
Output: ((1,2), (3))

Example 4

Input: @list = (1,2,3,4,5,6,7,8,9,10), $n = 5
Output: ((1,2), (3,4), (5,6), (7,8), (9,10))

Example 5

Input: @list = (1,2,3), $n = 4
Output: -1

Example 6

Input: @list = (72,57,89,55,36,84,10,95,99,35), $n = 7; 
Output: ((72,57), (89,55), (36,84), (10), (95), (99), (35))

Last date to submit the solution 23:59 (UK Time) Sunday 10th May 2026.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment