LanX has asked for the wisdom of the Perl Monks concerning the following question:
I stumbled over some blog posts choosing brute-forc'ish algos to solve the perl-weekly-challenge-206.
Here my take on it ... (I hid the "spoilers")
I hope my approaches are clever solutions, please correct me otherwise.
But I'm not too fond of my approach with List::Util::reduce() for task1. It's a hack to process successive pairs instead of even pairs.( 1-2 than 2-3 vs 3-4 )
Is there a more elegant way to do it with a function from List::Util ?
BTW: Generating the tests from the POD is nice too. :)
--- Task 1 ok 1 - ("00:00", "23:55", "20:00") -> 5 ok 2 - ("01:01", "00:50", "00:57") -> 4 ok 3 - ("10:10", "09:30", "09:00", "09:55") -> 15 --- Task 2 ok 4 - (1,2,3,4) -> 4 ok 5 - (0,2,1,3) -> 2 1..5
Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Weekly Challenge 206 with List::Util
by Anonymous Monk on Mar 17, 2023 at 18:56 UTC | |
|
Re: Perl Weekly Challenge 206 -- oneliner
by Discipulus (Canon) on Mar 18, 2023 at 09:55 UTC | |
|
Re: Perl Weekly Challenge 206 -- oneliner
by Discipulus (Canon) on Mar 20, 2023 at 08:56 UTC | |
by LanX (Saint) on Mar 20, 2023 at 11:13 UTC | |
|
Re: Perl Weekly Challenge 206 with List::Util
by hv (Prior) on Mar 17, 2023 at 17:57 UTC | |
by LanX (Saint) on Mar 17, 2023 at 18:06 UTC | |
by hv (Prior) on Mar 17, 2023 at 19:42 UTC |