diff options
| author | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2025-08-12 13:31:48 +0100 |
|---|---|---|
| committer | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2025-08-12 13:31:48 +0100 |
| commit | 3f0c25ac7a8089ff3d921c6e4926ff88ebd806cd (patch) | |
| tree | d724fd4de00416e89a12e04e691201c6b8c30a32 | |
| parent | 5ab49b30e61c47686b522263e7336766c9f5236a (diff) | |
| download | perlweeklychallenge-club-3f0c25ac7a8089ff3d921c6e4926ff88ebd806cd.tar.gz perlweeklychallenge-club-3f0c25ac7a8089ff3d921c6e4926ff88ebd806cd.tar.bz2 perlweeklychallenge-club-3f0c25ac7a8089ff3d921c6e4926ff88ebd806cd.zip | |
- Added solutions by Andrew Shitov.
- Added solutions by Simon Proctor.
- Added solutions by Eric Cheung.
- Added solutions by Feng Chang.
- Added solutions by Mark Anderson.
- Added solutions by PokGoPun.
- Added solutions by David Ferrone.
- Added solutions by Peter Campbell Smith.
- Added solutions by Conor Hoekstra.
- Added solutions by Peter Meszaros.
- Added solutions by Ali Moradi.
- Added solutions by W. Luis Mochan.
- Added solutions by Roger Bell_West.
26 files changed, 826 insertions, 524 deletions
diff --git a/challenge-334/eric-cheung/python/ch-1.py b/challenge-334/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..8f721b34a1 --- /dev/null +++ b/challenge-334/eric-cheung/python/ch-1.py @@ -0,0 +1,27 @@ +
+## Example 1
+## arrInts = [-2, 0, 3, -5, 2, -1]
+## nX = 0
+## nY = 2
+
+## Example 2
+## arrInts = [1, -2, 3, -4, 5]
+## nX = 1
+## nY = 3
+
+## Example 3
+## arrInts = [1, 0, 2, -1, 3]
+## nX = 3
+## nY = 4
+
+## Example 4
+## arrInts = [-5, 4, -3, 2, -1, 0]
+## nX = 0
+## nY = 3
+
+## Example 5
+arrInts = [-1, 0, 2, -3, -2, 1]
+nX = 0
+nY = 2
+
+print (sum(arrInts[nX:nY + 1]))
diff --git a/challenge-334/eric-cheung/python/ch-2.py b/challenge-334/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..4f61f989ba --- /dev/null +++ b/challenge-334/eric-cheung/python/ch-2.py @@ -0,0 +1,38 @@ +
+import numpy as np
+
+def GetManDist(arrValidInputPnt, arrCurPnt):
+ return abs(arrValidInputPnt[0] - arrCurPnt[0]) + abs(arrValidInputPnt[1] - arrCurPnt[1])
+
+## Example 1
+## nX = 3
+## nY = 4
+## arrPnts = [[1, 2], [3, 1], [2, 4], [2, 3]]
+
+## Example 2
+## nX = 2
+## nY = 5
+## arrPnts = [[3, 4], [2, 3], [1, 5], [2, 5]]
+
+## Example 3
+## nX = 1
+## nY = 1
+## arrPnts = [[2, 2], [3, 3], [4, 4]]
+
+## Example 4
+## nX = 0
+## nY = 0
+## arrPnts = [[0, 1], [1, 0], [0, 2], [2, 0]]
+
+## Example 5
+nX = 5
+nY = 5
+arrPnts = [[5, 6], [6, 5], [5, 4], [4, 5]]
+
+objValidPnts = {nIndx : arrPntLoop for nIndx, arrPntLoop in enumerate(arrPnts) if arrPntLoop[0] == nX or arrPntLoop[1] == nY}
+
+if len(objValidPnts) > 0:
+ nMinIndx = np.argmin([GetManDist(objValidPnts[nIndxKey], [nX, nY]) for nIndxKey in objValidPnts])
+ print ([nIndxKey for nIndx, nIndxKey in enumerate(objValidPnts) if nIndx == nMinIndx][0])
+else:
+ print (-1)
diff --git a/stats/pwc-challenge-333.json b/stats/pwc-challenge-333.json new file mode 100644 index 0000000000..09802125dd --- /dev/null +++ b/stats/pwc-challenge-333.json @@ -0,0 +1,653 @@ +{ + "chart" : { + "type" : "column" + }, + "drilldown" : { + "series" : [ + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Ali Moradi", + "name" : "Ali Moradi" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Andreas Mahnke", + "name" : "Andreas Mahnke" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Andrew Shitov", + "name" : "Andrew Shitov" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Arne Sommer", + "name" : "Arne Sommer" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Athanasius", + "name" : "Athanasius" + }, + { + "data" : [ + [ + "Raku", + 1 + ] + ], + "id" : "BarrOff", + "name" : "BarrOff" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Bob Lied", + "name" : "Bob Lied" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "David Ferrone", + "name" : "David Ferrone" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Feng Chang", + "name" : "Feng Chang" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Humberto Massa", + "name" : "Humberto Massa" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Jaldhar H. Vyas", + "name" : "Jaldhar H. Vyas" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Jan Krnavek", + "name" : "Jan Krnavek" + }, + { + "data" : [ + [ + "Perl", + 1 + ] + ], + "id" : "Jared Still", + "name" : "Jared Still" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Jorg Sommrey", + "name" : "Jorg Sommrey" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Kjetil Skotheim", + "name" : "Kjetil Skotheim" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 10 + ] + ], + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Matthew Neleigh", + "name" : "Matthew Neleigh" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Matthias Muth", + "name" : "Matthias Muth" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "mauke", + "name" : "mauke" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Packy Anderson", + "name" : "Packy Anderson" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Robbie Hatley", + "name" : "Robbie Hatley" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Simon Green", + "name" : "Simon Green" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Simon Proctor", + "name" : "Simon Proctor" + }, + { + "data" : [ + [ + "Perl", + 1 + ] + ], + "id" : "Solathian", + "name" : "Solathian" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Thomas Kohler", + "name" : "Thomas Kohler" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Wanderdoc", + "name" : "Wanderdoc" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Yitzchak Scott-Thoennes", + "name" : "Yitzchak Scott-Thoennes" + } + ] + }, + "legend" : { + "enabled" : 0 + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "series" : [ + { + "colorByPoint" : 1, + "data" : [ + { + "drilldown" : "Ali Moradi", + "name" : "Ali Moradi", + "y" : 3 + }, + { + "drilldown" : "Andreas Mahnke", + "name" : "Andreas Mahnke", + "y" : 2 + }, + { + "drilldown" : "Andrew Shitov", + "name" : "Andrew Shitov", + "y" : 2 + }, + { + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", + "y" : 3 + }, + { + "drilldown" : "Athanasius", + "name" : "Athanasius", + "y" : 4 + }, + { + "drilldown" : "BarrOff", + "name" : "BarrOff", + "y" : 1 + }, + { + "drilldown" : "Bob Lied", + "name" : "Bob Lied", + "y" : 3 + }, + { + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby", + "y" : 3 + }, + { + "drilldown" : "David Ferrone", + "name" : "David Ferrone", + "y" : 2 + }, + { + "drilldown" : "E. Choroba", + "name" : "E. Choroba", + "y" : 2 + }, + { + "drilldown" : "Feng Chang", + "name" : "Feng Chang", + "y" : 2 + }, + { + "drilldown" : "Humberto Massa", + "name" : "Humberto Massa", + "y" : 2 + }, + { + "drilldown" : "Jaldhar H. Vyas", + "name" : "Jaldhar H. Vyas", + "y" : 5 + }, + { + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek", + "y" : 2 + }, + { + "drilldown" : "Jared Still", + "name" : "Jared Still", + "y" : 1 + }, + { + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey", + "y" : 3 + }, + { + "drilldown" : "Kjetil Skotheim", + "name" : "Kjetil Skotheim", + "y" : 2 + }, + { + "drilldown" : "Luca Ferrari", + "name" : "Luca Ferrari", + "y" : 12 + }, + { + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson", + "y" : 2 + }, + { + "drilldown" : "Matthew Neleigh", + "name" : "Matthew Neleigh", + "y" : 2 + }, + { + "drilldown" : "Matthias Muth", + "name" : "Matthias Muth", + "y" : 3 + }, + { + "drilldown" : "mauke", + "name" : "mauke", + "y" : 2 + }, + { + "drilldown" : "Packy Anderson", + "name" : "Packy Anderson", + "y" : 5 + }, + { + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith", + "y" : 3 + }, + { + "drilldown" : "Peter Meszaros", + "name" : "Peter Meszaros", + "y" : 2 + }, + { + "drilldown" : "Robbie Hatley", + "name" : "Robbie Hatley", + "y" : 3 + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 5 + }, + { + "drilldown" : "Simon Green", + "name" : "Simon Green", + "y" : 3 + }, + { + "drilldown" : "Simon Proctor", + "name" : "Simon Proctor", + "y" : 2 + }, + { + "drilldown" : "Solathian", + "name" : "Solathian", + "y" : 1 + }, + { + "drilldown" : "Thomas Kohler", + "name" : "Thomas Kohler", + "y" : 4 + }, + { + "drilldown" : "Ulrich Rieke", + "name" : "Ulrich Rieke", + "y" : 4 + }, + { + "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan", + "y" : 3 + }, + { + "drilldown" : "Wanderdoc", + "name" : "Wanderdoc", + "y" : 2 + }, + { + "drilldown" : "Yitzchak Scott-Thoennes", + "name" : "Yitzchak Scott-Thoennes", + "y" : 2 + } + ], + "name" : "The Weekly Challenge - 333" + } + ], + "subtitle" : { + "text" : "[Champions: 35] Last updated at 2025-08-12 12:31:10 GMT" + }, + "title" : { + "text" : "The Weekly Challenge - 333" + }, + "tooltip" : { + "followPointer" : 1, + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" + }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index bcffd4531d..f91b4ae5a0 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -21,18 +21,8 @@ { "data" : [ [ - "Perl", - 2 - ] - ], - "id" : "Andreas Mahnke", - "name" : "Andreas Mahnke" - }, - { - "data" : [ - [ "Raku", - 2 + 1 ] ], "id" : "Andrew Shitov", @@ -41,72 +31,6 @@ { "data" : [ [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Arne Sommer", - "name" : "Arne Sommer" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "id" : "Athanasius", - "name" : "Athanasius" - }, - { - "data" : [ - [ - "Raku", - 1 - ] - ], - "id" : "BarrOff", - "name" : "BarrOff" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Bob Lied", - "name" : "Bob Lied" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Dave Jacoby", - "name" : "Dave Jacoby" - }, - { - "data" : [ - [ "Perl", 2 ] @@ -117,16 +41,6 @@ { "data" : [ [ - "Perl", - 2 - ] - ], - "id" : "E. Choroba", - "name" : "E. Choroba" - }, - { - "data" : [ - [ "Raku", 2 ] @@ -141,92 +55,6 @@ 2 ] ], - "id" : "Humberto Massa", - "name" : "Humberto Massa" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Jaldhar H. Vyas", - "name" : "Jaldhar H. Vyas" - }, - { - "data" : [ - [ - "Raku", - 2 - ] - ], - "id" : "Jan Krnavek", - "name" : "Jan Krnavek" - }, - { - "data" : [ - [ - "Perl", - 1 - ] - ], - "id" : "Jared Still", - "name" : "Jared Still" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Jorg Sommrey", - "name" : "Jorg Sommrey" - }, - { - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "Kjetil Skotheim", - "name" : "Kjetil Skotheim" - }, - { - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 10 - ] - ], - "id" : "Luca Ferrari", - "name" : "Luca Ferrari" - }, - { - "data" : [ - [ - "Raku", - 2 - ] - ], "id" : "Mark Anderson", "name" : "Mark Anderson" }, @@ -235,58 +63,6 @@ [ "Perl", 2 - ] - ], - "id" : "Matthew Neleigh", - "name" : "Matthew Neleigh" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Matthias Muth", - "name" : "Matthias Muth" - }, - { - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "mauke", - "name" : "mauke" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Packy Anderson", - "name" : "Packy Anderson" - }, - { - "data" : [ - [ - "Perl", - 2 ], [ "Blog", @@ -313,26 +89,8 @@ 2 ], [ - "Blog", - 1 - ] - ], - "id" : "Robbie Hatley", - "name" : "Robbie Hatley" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ "Raku", 2 - ], - [ - "Blog", - 1 |
