diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-07-24 12:37:53 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-07-24 12:37:53 +0100 |
| commit | d4ef2c42773b5878950e4b55741fb2934705ddeb (patch) | |
| tree | 1bdccb3f070773793cc10470c5ad5549487e0dd4 | |
| parent | b27c87b1c0b4b8ffb916d9938c373e4d60d82dc1 (diff) | |
| download | perlweeklychallenge-club-d4ef2c42773b5878950e4b55741fb2934705ddeb.tar.gz perlweeklychallenge-club-d4ef2c42773b5878950e4b55741fb2934705ddeb.tar.bz2 perlweeklychallenge-club-d4ef2c42773b5878950e4b55741fb2934705ddeb.zip | |
- Added solutions by Mark Anderson
- Added Swift solution to Task #1 of Week #069.
| -rw-r--r-- | challenge-069/mohammad-anwar/swift/ch-1.swift | 73 | ||||
| -rw-r--r-- | stats/pwc-current.json | 243 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 62 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 440 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 360 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 56 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 92 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 96 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 60 |
12 files changed, 906 insertions, 818 deletions
diff --git a/challenge-069/mohammad-anwar/swift/ch-1.swift b/challenge-069/mohammad-anwar/swift/ch-1.swift new file mode 100644 index 0000000000..cad8eb1c81 --- /dev/null +++ b/challenge-069/mohammad-anwar/swift/ch-1.swift @@ -0,0 +1,73 @@ +import Foundation + +/* +Perl Weekly Challenge - 069 + +Task #1: Strobogrammatic Number + +https://perlweeklychallenge.org/blog/perl-weekly-challenge-069 +*/ + +extension Int { + var digits : [Int] { + var result = [Int]() + var remaining = abs(self) + while remaining > 0 { + result.insert(remaining % 10, at: 0) + remaining /= 10 + } + return result + } +} + +enum ParamError: Error { + case missingAandB + case missingB +} + +do { + let paramCount:Int = Int(CommandLine.argc) + + if paramCount <= 1 { + throw ParamError.missingAandB + } + else if paramCount <= 2 { + throw ParamError.missingB + } + + let A:Int = Int(CommandLine.arguments[1])! + let B:Int = Int(CommandLine.arguments[2])! + + var strobogrammatic:[Int] = [] + let digits: [Int: Int] = [6 : 9, 8 : 8, 9 : 6] + for i in A...B { + var found:Bool = true + var match:String = "" + for d in i.digits { + if digits[d] != nil { + match += String(digits[d]!) + } + else { + found = false + break + } + } + + if found { + if String(i) == String(match.reversed()) { + strobogrammatic.append(i) + } + } + } + + print(strobogrammatic) +} +catch ParamError.missingAandB { + print("Missing A and B") +} +catch ParamError.missingB { + print("Missing B") +} +catch let error { + print(error) +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index dc4342b069..fac7f45579 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,27 +1,93 @@ { - "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/>" - }, - "subtitle" : { - "text" : "[Champions: 14] Last updated at 2020-07-23 16:41:46 GMT" - }, - "title" : { - "text" : "Perl Weekly Challenge - 070" - }, - "legend" : { - "enabled" : 0 - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" + "series" : [ + { + "name" : "Perl Weekly Challenge - 070", + "data" : [ + { + "name" : "Andrew Shitov", + "y" : 4, + "drilldown" : "Andrew Shitov" + }, + { + "name" : "Athanasius", + "drilldown" : "Athanasius", + "y" : 4 + }, + { + "drilldown" : "Dave Jacoby", + "y" : 2, + "name" : "Dave Jacoby" + }, + { + "name" : "Javier Luque", + "y" : 5, + "drilldown" : "Javier Luque" + }, + { + "name" : "Jorg Sommrey", + "y" : 2, + "drilldown" : "Jorg Sommrey" + }, + { + "y" : 4, + "drilldown" : "Luca Ferrari", + "name" : "Luca Ferrari" + }, + { + "y" : 2, + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "drilldown" : "Mohammad S Anwar", + "y" : 4, + "name" : "Mohammad S Anwar" + }, + { + "drilldown" : "Pete Houston", + "y" : 2, + "name" : "Pete Houston" + }, + { + "name" : "Roger Bell_West", + "y" : 5, + "drilldown" : "Roger Bell_West" + }, + { + "name" : "Simon Green", + "y" : 3, + "drilldown" : "Simon Green" + }, + { + "drilldown" : "Simon Proctor", + "y" : 2, + "name" : "Simon Proctor" + }, + { + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke", + "y" : 4 + }, + { + "name" : "Walt Mankowski", + "y" : 2, + "drilldown" : "Walt Mankowski" + }, + { + "name" : "Wanderdoc", + "drilldown" : "Wanderdoc", + "y" : 2 + } + ], + "colorByPoint" : 1 } + ], + "xAxis" : { + "type" : "category" }, "drilldown" : { "series" : [ { - "name" : "Andrew Shitov", "data" : [ [ "Raku", @@ -32,9 +98,11 @@ 2 ] ], + "name" : "Andrew Shitov", "id" : "Andrew Shitov" }, { + "id" : "Athanasius", "name" : "Athanasius", "data" : [ [ @@ -45,18 +113,17 @@ "Raku", 2 ] - ], - "id" : "Athanasius" + ] }, { - "id" : "Dave Jacoby", "data" : [ [ "Perl", 2 ] ], - "name" : "Dave Jacoby" + "name" : "Dave Jacoby", + "id" : "Dave Jacoby" }, { "data" : [ @@ -87,6 +154,7 @@ "id" : "Jorg Sommrey" }, { + "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -97,11 +165,19 @@ 2 ] ], - "name" : "Luca Ferrari", - "id" : "Luca Ferrari" + "name" : "Luca Ferrari" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Mark Anderson", + "id" : "Mark Anderson" }, { - "name" : "Mohammad S Anwar", "data" : [ [ "Perl", @@ -112,6 +188,7 @@ 2 ] ], + "name" : "Mohammad S Anwar", "id" : "Mohammad S Anwar" }, { @@ -143,7 +220,7 @@ ] }, { - "name" : "Simon Green", + "id" : "Simon Green", "data" : [ [ "Perl", @@ -154,7 +231,7 @@ 1 ] ], - "id" : "Simon Green" + "name" : "Simon Green" }, { "id" : "Simon Proctor", @@ -181,118 +258,56 @@ ] }, { - "id" : "Walt Mankowski", "name" : "Walt Mankowski", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Walt Mankowski" }, { - "id" : "Wanderdoc", + "name" : "Wanderdoc", "data" : [ [ "Perl", 2 ] ], - "name" : "Wanderdoc" + "id" : "Wanderdoc" } ] }, - "xAxis" : { - "type" : "category" - }, - "series" : [ - { - "colorByPoint" : 1, - "name" : "Perl Weekly Challenge - 070", - "data" : [ - { - "drilldown" : "Andrew Shitov", - "y" : 4, - "name" : "Andrew Shitov" - }, - { - "name" : "Athanasius", - "y" : 4, - "drilldown" : "Athanasius" - }, - { - "drilldown" : "Dave Jacoby", - "y" : 2, - "name" : "Dave Jacoby" - }, - { - "name" : "Javier Luque", - "y" : 5, - "drilldown" : "Javier Luque" - }, - { - "name" : "Jorg Sommrey", - "drilldown" : "Jorg Sommrey", - "y" : 2 - }, - { - "y" : 4, - "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari" - }, - { - "drilldown" : "Mohammad S Anwar", - "y" : 4, - "name" : "Mohammad S Anwar" - }, - { - "y" : 2, - "drilldown" : "Pete Houston", - "name" : "Pete Houston" - }, - { - "name" : "Roger Bell_West", - "drilldown" : "Roger Bell_West", - "y" : 5 - }, - { - "y" : 3, - "drilldown" : "Simon Green", - "name" : "Simon Green" - }, - { - "drilldown" : "Simon Proctor", - "y" : 2, - "name" : "Simon Proctor" - }, - { - "name" : "Ulrich Rieke", - "y" : 4, - "drilldown" : "Ulrich Rieke" - }, - { - "drilldown" : "Walt Mankowski", - "y" : 2, - "name" : "Walt Mankowski" - }, - { - "name" : "Wanderdoc", - "y" : 2, - "drilldown" : "Wanderdoc" - } - ] - } - ], "chart" : { "type" : "column" }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, "plotOptions" : { "series" : { "borderWidth" : 0, "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 + "enabled" : 1, + "format" : "{point.y}" } } + }, + "legend" : { + "enabled" : 0 + }, + "tooltip" : { + "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" + }, + "subtitle" : { + "text" : "[Champions: 15] Last updated at 2020-07-24 11:37:40 GMT" + }, + "title" : { + "text" : "Perl Weekly Challenge - 070" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 59fd018a6d..6005d4792d 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,26 +1,47 @@ { + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + }, + "subtitle" : { + "text" : "Last updated at 2020-07-24 11:37:40 GMT" + }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, + "legend" : { + "enabled" : "false" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, + "chart" : { + "type" : "column" + }, "xAxis" : { - "type" : "category", "labels" : { "style" : { "fontSize" : "13px", "fontFamily" : "Verdana, sans-serif" } - } + }, + "type" : "category" }, "series" : [ { "dataLabels" : { - "color" : "#FFFFFF", + "rotation" : -90, "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" }, - "rotation" : -90, "align" : "right", + "y" : 10, "enabled" : "true", - "format" : "{point.y:.0f}", - "y" : 10 + "color" : "#FFFFFF", + "format" : "{point.y:.0f}" }, "name" : "Contributions", "data" : [ @@ -34,30 +55,9 @@ ], [ "Raku", - 1850 + 1852 ] ] } - ], - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : "false" - }, - "subtitle" : { - "text" : "Last updated at 2020-07-23 16:41:46 GMT" - }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - } + ] } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 8d47664506..68684f26e5 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,30 +1,7 @@ { - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-07-23 16:41:46 GMT" - }, - "legend" : { - "enabled" : "false" - }, - "title" : { - "text" : "Perl Weekly Challenge Language" - }, - "tooltip" : { - "followPointer" : "true", - "headerFormat" : "<span style=\"font-size:11px\"></span>", - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "xAxis" : { - "type" : "category" - }, "drilldown" : { "series" : [ { - "id" : "001", "name" : "001", "data" : [ [ @@ -39,10 +16,11 @@ "Blog", 11 ] - ] + ], + "id" : "001" }, { - "id" : "002", + "name" : "002", "data" : [ [ "Perl", @@ -57,9 +35,10 @@ 10 ] ], - "name" : "002" + "id" : "002" }, { + "id" : "003", "data" : [ [ "Perl", @@ -74,12 +53,10 @@ 9 ] ], - "name" : "003", - "id" : "003" + "name" : "003" }, { "id" : "004", - "name" : "004", "data" : [ [ "Perl", @@ -93,7 +70,8 @@ "Blog", 10 ] - ] + ], + "name" : "004" }, { "data" : [ @@ -115,7 +93,6 @@ }, { "id" : "006", - "name" : "006", "data" : [ [ "Perl", @@ -129,10 +106,10 @@ "Blog", 7 ] - ] + ], + "name" : "006" }, { - "id" : "007", "data" : [ [ "Perl", @@ -147,10 +124,11 @@ 10 ] ], - "name" : "007" + "name" : "007", + "id" : "007" }, { - "name" : "008", + "id" : "008", "data" : [ [ "Perl", @@ -165,7 +143,7 @@ 12 ] ], - "id" : "008" + "name" : "008" }, { "id" : "009", @@ -204,7 +182,6 @@ ] }, { - "name" : "011", "data" : [ [ "Perl", @@ -219,11 +196,11 @@ 10 ] ], + "name" : "011", "id" : "011" }, { "id" : "012", - "name" : "012", "data" : [ [ "Perl", @@ -237,10 +214,10 @@ "Blog", 11 ] - ] + ], + "name" : "012" }, { - "id" : "013", "name" : "013", "data" : [ [ @@ -255,10 +232,11 @@ "Blog", 13 ] - ] + ], + "id" : "013" }, { - "id" : "014", + "name" : "014", "data" : [ [ "Perl", @@ -273,7 +251,7 @@ 15 ] ], - "name" : "014" + "id" : "014" }, { "id" : "015", @@ -313,6 +291,7 @@ }, { "id" : "017", + "name" : "017", "data" : [ [ "Perl", @@ -326,11 +305,10 @@ "Blog", 12 ] - ], - "name" : "017" + ] }, { - "name" : "018", + "id" : "018", "data" : [ [ "Perl", @@ -345,11 +323,10 @@ 14 ] ], - "id" : "018" + "name" : "018" }, { "id" : "019", - "name" : "019", "data" : [ [ "Perl", @@ -363,7 +340,8 @@ "Blog", 13 ] - ] + ], + "name" : "019" }, { "data" : [ @@ -421,7 +399,6 @@ }, { "id" : "023", - "name" : "023", "data" : [ [ "Perl", @@ -435,10 +412,10 @@ "Blog", 12 ] - ] + ], + "name" : "023" }, { - "name" : "024", "data" : [ [ "Perl", @@ -453,11 +430,11 @@ 11 ] ], + "name" : "024", "id" : "024" }, { "id" : "025", - "name" : "025", "data" : [ [ "Perl", @@ -471,10 +448,10 @@ "Blog", 12 ] - ] + ], + "name" : "025" }, { - "name" : "026", "data" : [ [ "Perl", @@ -489,11 +466,11 @@ 10 ] ], + "name" : "026", "id" : "026" }, { "id" : "027", - "name" : "027", "data" : [ [ "Perl", @@ -507,10 +484,11 @@ "Blog", 9 ] - ] + ], + "name" : "027" }, { - "name" : "028", + "id" : "028", "data" : [ [ "Perl", @@ -525,7 +503,7 @@ 9 ] ], - "id" : "028" + "name" : "028" }, { "id" : "029", @@ -564,6 +542,7 @@ "id" : "030" }, { + "name" : "031", "data" : [ [ "Perl", @@ -578,11 +557,11 @@ 9 ] ], - "name" : "031", "id" : "031" }, { "id" : "032", + "name" : "032", "data" : [ [ "Perl", @@ -596,11 +575,10 @@ "Blog", 10 ] - ], - "name" : "032" + ] }, { - "id" : "033", + "name" : "033", "data" : [ [ "Perl", @@ -615,10 +593,10 @@ 10 ] ], - "name" : "033" + "id" : "033" }, { - "id" : "034", + "name" : "034", "data" : [ [ "Perl", @@ -633,11 +611,9 @@ 11 ] ], - "name" : "034" + "id" : "034" }, { - "id" : "035", - "name" : "035", "data" : [ [ "Perl", @@ -651,9 +627,13 @@ "Blog", 9 ] - ] + ], + "name" : "035", + "id" : "035" }, { + "id" : "036", + "name" : "036", "data" : [ [ "Perl", @@ -667,11 +647,11 @@ "Blog", 11 ] - ], - "name" : "036", - "id" : "036" + ] }, { + "id" : "037", + "name" : "037", "data" : [ [ "Perl", @@ -685,11 +665,10 @@ "Blog", 9 ] - ], - "name" : "037", - "id" : "037" + ] }, { + "name" : "038", "data" : [ [ "Perl", @@ -704,11 +683,9 @@ 12 ] ], - "name" : "038", "id" : "038" }, { - "id" : "039", "data" : [ [ "Perl", @@ -723,10 +700,11 @@ 12 ] ], - "name" : "039" + "name" : "039", + "id" : "039" }, { - "id" : "040", + "name" : "040", "data" : [ [ "Perl", @@ -741,9 +719,10 @@ 10 ] ], - "name" : "040" + "id" : "040" }, { + "name" : "041", "data" : [ [ "Perl", @@ -758,7 +737,6 @@ 9 ] ], - "name" : "041", "id" : "041" }, { @@ -780,7 +758,7 @@ "id" : "042" }, { - "id" : "043", + "name" : "043", "data" : [ [ "Perl", @@ -795,10 +773,9 @@ 11 ] ], - "name" : "043" + "id" : "043" }, { - "id" : "044", "data" : [ [ "Perl", @@ -813,7 +790,8 @@ 11 ] ], - "name" : "044" + "name" : "044", + "id" : "044" }, { "id" : "045", @@ -834,7 +812,6 @@ "name" : "045" }, { - "id" : "046", "data" : [ [ "Perl", @@ -849,11 +826,10 @@ 10 ] ], - "name" : "046" + "name" : "046", + "id" : "046" }, { - "id" : "047", - "name" : "047", "data" : [ [ "Perl", @@ -867,9 +843,12 @@ "Blog", 10 ] - ] + ], + "name" : "047", + "id" : "047" }, { + "id" : "048", "name" : "048", "data" : [ [ @@ -884,12 +863,9 @@ "Blog", 12 ] - ], - "id" : "048" + ] }, { - "id" : "049", - "name" : "049", "data" : [ [ "Perl", @@ -903,7 +879,9 @@ "Blog", 12 ] - ] + ], + "name" : "049", + "id" : "049" }, { "name" : "050", @@ -924,7 +902,6 @@ "id" : "050" }, { - "name" : "051", "data" : [ [ "Perl", @@ -939,6 +916,7 @@ 11 ] ], + "name" : "051", "id" : "051" }, { @@ -960,6 +938,8 @@ "name" : "052" }, { + "id" : "053", + "name" : "053", "data" : [ [ "Perl", @@ -973,11 +953,11 @@ "Blog", 15 ] - ], - "name" : "053", - "id" : "053" + ] }, { + "id" : "054", + "name" : "054", "data" : [ [ "Perl", @@ -991,11 +971,10 @@ "Blog", 18 ] - ], - "name" : "054", - "id" : "054" + ] }, { + "name" : "055", "data" : [ [ "Perl", @@ -1010,11 +989,11 @@ 14 ] ], - "name" : "055", "id" : "055" }, { "id" : "056", + "name" : "056", "data" : [ [ "Perl", @@ -1028,12 +1007,9 @@ "Blog", 16 ] - ], - "name" : "056" + ] }, { - "id" : "057", - "name" : "057", "data" : [ [ "Perl", @@ -1047,10 +1023,12 @@ "Blog", 15 ] - ] + ], + "name" : "057", + "id" : "057" }, { - "id" : "058", + "name" : "058", |
