Last active
January 26, 2026 02:47
-
-
Save manwar/1d82226127a5b126d69e242c6fa55c52 to your computer and use it in GitHub Desktop.
The Weekly Challenge - 358
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The Weekly Challenge - 358 | |
| ##### Early Bird Club members ONLY | |
| ## Task 1: Max Str Value | |
| ##### **Submitted by:** [Mohammad Sajid Anwar](https://manwar.org) | |
| You are given an array of alphanumeric string, `@strings`. | |
| Write a script to find the max value of alphanumeric string in the given array. The numeric representation of the string, if it comprises of digits only otherwise length of the string. | |
| #### Example 1 | |
| Input: @strings = ("123", "45", "6") | |
| Output: 123 | |
| All strings contain only digits, so their base-10 numeric values are compared. | |
| <br> | |
| #### Example 2 | |
| Input: @strings = ("abc", "de", "fghi") | |
| Output: 4 | |
| None of the strings are purely numeric, so their values are their lengths; "fghi" has the maximum length. | |
| <br> | |
| #### Example 3 | |
| Input: @strings = ("0012", "99", "a1b2c") | |
| Output: 99 | |
| "0012" evaluates to 12, "99" to 99, and "a1b2c" has length 5; the maximum value is 99. | |
| <br> | |
| #### Example 4 | |
| Input: @strings = ("x", "10", "xyz", "007") | |
| Output: 10 | |
| "x" -> 1 | |
| "xyz" -> 3 | |
| "007" -> 7 | |
| "10" -> 10 | |
| <br> | |
| #### Example 5 | |
| Input: @strings = ("hello123", "2026", "perl") | |
| Output: 2026 | |
| "hello123" and "perl" are non-numeric (lengths 8 and 4) | |
| "2026" is numeric; the maximum value is 2026. | |
| <br> | |
| ## Task 2: Encrypted String | |
| ##### **Submitted by:** [Mohammad Sajid Anwar](https://manwar.org) | |
| You are given a string `$str` and an integer `$int`. | |
| Write a script to encrypt the string using the algorithm - for each character `$char` in `$str`, replace `$char` with the `$int` th character after `$char` in the alphabet, wrapping if needed and return the encrypted string. | |
| #### Example 1 | |
| Input: $str = "abc", $int = 1 | |
| Output: "bcd" | |
| <br> | |
| #### Example 2 | |
| Input: $str = "xyz", $int = 2 | |
| Output: "zab" | |
| <br> | |
| #### Example 3 | |
| Input: $str = "abc", $int = 27 | |
| Output: "bcd" | |
| <br> | |
| #### Example 4 | |
| Input: $str = "hello", $int = 5 | |
| Output: "mjqqt" | |
| <br> | |
| #### Example 5 | |
| Input: $str = "perl", $int = 26 | |
| Output: "perl" | |
| <br> | |
| *** | |
| Last date to submit the solution **23:59 (UK Time) Sunday 1<sup>st</sup> February 2026**. | |
| *** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment