From 996112d2e3daa2be2425e08aec3ce172f71b841b Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 8 Jul 2024 03:05:52 +0100 Subject: - Added template for week 277. --- challenge-277/0rir/README | 2 + challenge-277/2colours/README | 1 + challenge-277/3ter/README | 1 + challenge-277/LoneWolfiNTj/README | 1 + challenge-277/aaron-rowe/README | 1 + challenge-277/aaron-sherman/README | 1 + challenge-277/aaronreidsmith/README | 1 + challenge-277/abigail/README.md | 1 + challenge-277/adam-russell/.gitignore | 3 + challenge-277/adam-russell/README | 1 + challenge-277/adherzog/README | 1 + challenge-277/adriaandens/README | 1 + challenge-277/aecepoglu/README | 3 + challenge-277/ailbhe-tweedie/README | 1 + challenge-277/alex-daniel/README | 1 + challenge-277/alexander-karelas/README | 1 + challenge-277/alexander-pankoff/README | 1 + challenge-277/alicia-bielsa/README | 1 + challenge-277/andinus/README | 69 +++++ challenge-277/andreas-voegele/README | 1 + challenge-277/andrezgz/README | 1 + challenge-277/anton-fedotov/README | 1 + challenge-277/antonio-gamiz/README | 1 + challenge-277/ap29600/README | 1 + challenge-277/archargelod/README | 1 + challenge-277/arne-sommer/README | 1 + challenge-277/arpad-toth/README | 1 + challenge-277/ash/README | 1 + challenge-277/asherbhs/README | 1 + challenge-277/asherbhs/hy/.gitignore | 1 + challenge-277/athanasius/README | 1 + challenge-277/atschneid/README.md | 343 +++++++++++++++++++++ challenge-277/aubrey-quarcoo/README | 1 + challenge-277/augiedb/README | 1 + challenge-277/aut0exec/README | 1 + challenge-277/avery-adams/README | 1 + challenge-277/aviral-goel/README | 1 + challenge-277/barroff/README | 1 + challenge-277/baryshevs/README | 1 + challenge-277/bejoy-mathews/README | 1 + challenge-277/belmark-caday/README | 1 + challenge-277/ben-davies/README.md | 1 + challenge-277/bhat_gurunandan/README | 1 + challenge-277/bill-palmer/README | 1 + challenge-277/bkb/README | 1 + challenge-277/bn-ssotka/README | 2 + challenge-277/bob-kleemann/README | 1 + challenge-277/bob-lied/README | 4 + challenge-277/brtastic/README | 1 + challenge-277/brtastic/c/.gitignore | 2 + challenge-277/brtastic/pascal/.gitignore | 3 + challenge-277/bruce-gray/README | 1 + challenge-277/bruno-ramos/README | 1 + challenge-277/brxfork/README | 1 + challenge-277/burkhard-nickels/README | 1 + challenge-277/bwva/README | 1 + challenge-277/carlos-oliveira/README | 1 + challenge-277/chazzka/README | 1 + challenge-277/cheok-yin-fung/README | 1 + challenge-277/chicagoist/README.md | 1 + challenge-277/christian-jaeger/README | 1 + challenge-277/clifton-wood/README | 1 + challenge-277/cliveholloway/README | 1 + challenge-277/colin-crain/README | 1 + challenge-277/conor-hoekstra/README | 1 + challenge-277/craig/README | 1 + challenge-277/creewick/README | 1 + challenge-277/cristian-heredia/README | 1 + challenge-277/cybersnyder/README | 1 + challenge-277/dan-friedman/README | 1 + challenge-277/daniel-aberger/README | 2 + challenge-277/daniel-mantovani/README | 1 + challenge-277/daniel-mita/README | 1 + challenge-277/daniel-pfeiffer/README | 1 + challenge-277/dario-mazzeo/README | 1 + challenge-277/darren-bottin/README | 1 + challenge-277/dave-cross/README | 1 + challenge-277/dave-jacoby/README | 1 + challenge-277/david-kayal/README | 1 + challenge-277/david-santiago/README | 1 + challenge-277/ddobbelaere/README | 1 + challenge-277/deadmarshal/README | 1 + challenge-277/demerphq/README | 1 + challenge-277/demerphq/js/.gitignore | 2 + challenge-277/denis-yurashku/README | 1 + challenge-277/dms061/readme | 8 + challenge-277/donald-hunter/README | 1 + challenge-277/doug-schrag/README | 1 + challenge-277/dracos/README | 1 + challenge-277/duane-powell/README | 1 + challenge-277/duncan-c-white/C/.cbuild | 5 + challenge-277/duncan-c-white/README | 76 +++++ challenge-277/e-choroba/README | 1 + challenge-277/ealvar3z/README | 1 + challenge-277/eddy-hs/README | 1 + challenge-277/eric-cheung/README | 1 + challenge-277/fabrizio-poggi/README | 1 + challenge-277/feng-chang/README.md | 2 + challenge-277/finanalyst/README | 1 + challenge-277/finley/README | 1 + challenge-277/fjwhittle/README | 1 + challenge-277/frankivo/README | 1 + challenge-277/fred-zinn/README | 1 + challenge-277/freddie-b/README | 1 + challenge-277/garrett-goebel/README | 1 + challenge-277/giuseppe-terlizzi/README | 1 + challenge-277/gugod/README | 1 + challenge-277/gugod/rust/.gitignore | 2 + challenge-277/guillermo-ramos/README | 1 + challenge-277/gustavo-chaves/README | 1 + challenge-277/habere-et-dispetire/README | 1 + challenge-277/happy-barney/README | 1 + challenge-277/hatorikibble/README | 1 + challenge-277/hauke-d/README | 1 + challenge-277/henry-wong/README | 1 + challenge-277/hstejas/README | 1 + challenge-277/iangoodnight/README.md | 2 + challenge-277/iangoodnight/python/.gitignore | 1 + challenge-277/ianrifkin/README.md | 225 ++++++++++++++ challenge-277/izem/README | 1 + challenge-277/izifresh/README | 1 + challenge-277/jacques-guinnebault/README | 1 + challenge-277/jaguart/README.md | 6 + challenge-277/jaime/README | 59 ++++ challenge-277/jake/README | 1 + challenge-277/jaldhar-h-vyas/README | 1 + challenge-277/james-marquis/README | 1 + challenge-277/james-raspass/README | 1 + challenge-277/james-smith/README.md | 1 + challenge-277/jan-perl/README | 1 + challenge-277/jaredor/README | 1 + challenge-277/jason-messer/README | 1 + challenge-277/javier-luque/README | 1 + challenge-277/jbourlakos/README | 1 + challenge-277/jcrosswh/README | 1 + challenge-277/jdos22/README | 1 + challenge-277/jeanluc2020/README | 1 + challenge-277/jeff/README | 1 + challenge-277/jeongoon/.gitignore | 5 + challenge-277/jeongoon/README | 1 + challenge-277/jeremy-carman/README | 1 + challenge-277/jim-bacon/README | 1 + challenge-277/jitu-keshwani/README | 1 + challenge-277/jj-merelo/README | 1 + challenge-277/jluis/README | 1 + challenge-277/jo-37/README | 1 + challenge-277/jo-christian-oterhals/README | 1 + challenge-277/joaofel/README | 1 + challenge-277/joe-tym/README | 1 + challenge-277/joelle-maslak/README | 1 + challenge-277/john-barrett/README | 1 + challenge-277/john-horner/README | 1 + challenge-277/jokraft/README | 1 + challenge-277/juan-caballero/README | 1 + challenge-277/julien-fiegehenn/README | 1 + challenge-277/julien-fiegehenn/perl/.gitignore | 1 + .../julien-fiegehenn/typescript/.gitignore | 3 + challenge-277/julien-fiegehenn/typescript/.nvmrc | 1 + challenge-277/juliodcs/README | 1 + challenge-277/kai-burgdorf/README.md | 1 + challenge-277/kaushik-tunuguntla/README | 1 + challenge-277/kevin-colyer/README | 3 + challenge-277/khalid-anwar/README | 1 + challenge-277/khalid/README | 1 + challenge-277/kian-meng-ang/README | 1 + challenge-277/kiran-kumar/README | 1 + challenge-277/kivanc-yazan/.gitignore | 2 + challenge-277/kivanc-yazan/README | 1 + challenge-277/kjetillll/README | 1 + challenge-277/kordaff/README | 1 + challenge-277/kostas-giannakakis/README | 1 + challenge-277/kueppo-wesley/README | 1 + challenge-277/kurkale6ka/README | 1 + challenge-277/lacek96/README | 1 + challenge-277/lance-wicks/README | 1 + challenge-277/lars-balker/README | 1 + challenge-277/lars-thegler/README | 1 + challenge-277/laurent-rosenfeld/README | 1 + challenge-277/leoltron/README | 1 + challenge-277/librasteve/README | 1 + challenge-277/lubos-kolouch/README | 1 + challenge-277/luc65r/README | 1 + challenge-277/luca-ferrari/pljava/pom.xml | 72 +++++ challenge-277/luiz-felipe/README | 1 + challenge-277/macy-ty/README | 1 + challenge-277/magnus-woldrich/README | 1 + challenge-277/manfredi/README | 1 + challenge-277/mano-chandar/README | 1 + challenge-277/mark-anderson/README | 1 + challenge-277/mark-senn/README | 1 + challenge-277/markjreed/README | 6 + challenge-277/markus-holzer/README | 1 + challenge-277/martin-barth/README | 1 + challenge-277/martin-mugeni/README | 1 + challenge-277/massa/README | 1 + challenge-277/mathmauney/README | 1 + challenge-277/matt-latusek/README | 1 + challenge-277/matthew-persico/README | 1 + challenge-277/matthias-muth/README.md | 5 + challenge-277/mattneleigh/README | 1 + challenge-277/mauke/README | 1 + challenge-277/maxim-kolodyazhny/README | 1 + challenge-277/maxim-nechaev/README | 1 + challenge-277/memark/README | 1 + challenge-277/mgo1977/README | 2 + challenge-277/michael-hamlin/README | 5 + challenge-277/michael-schaap/README | 1 + challenge-277/mihail-iosilevitch/README | 1 + challenge-277/mike-accardo/README | 1 + challenge-277/mimosinnet/README | 1 + challenge-277/mohammad-anwar/README | 1 + challenge-277/morayj/README | 1 + challenge-277/ndelucca/README | 1 + challenge-277/neil-bowers/README | 1 + challenge-277/nelo-tovar/README.md | 1 + challenge-277/nick-logan/README | 1 + challenge-277/nicolas-mendoza/README | 2 + challenge-277/nikhil-prasanna/README | 1 + challenge-277/noud/README | 1 + challenge-277/nunovieira220/README | 1 + challenge-277/ohmycloud/README | 1 + challenge-277/oleksii-tsvietnov/README | 1 + challenge-277/oliver-oviedo/README | 1 + challenge-277/olivier-delouya/README | 1 + challenge-277/olli-antti/README | 1 + challenge-277/orestis-zekai/README | 1 + challenge-277/ozzy/README | 1 + challenge-277/p6steve/README | 1 + challenge-277/pablo-saavedra/README | 1 + challenge-277/packy-anderson/README.md | 25 ++ challenge-277/paul-fajman/README | 1 + challenge-277/paulo-custodio/README | 1 + challenge-277/pavel-jurca/README | 1 + challenge-277/pavel-starikov/README | 1 + challenge-277/pavel_kuptsov/README | 2 + challenge-277/perlboy1967/README | 1 + challenge-277/pete-houston/README | 1 + challenge-277/pete-sergeant/README | 1 + challenge-277/peter-campbell-smith/README | 1 + challenge-277/peter-meszaros/README | 1 + challenge-277/peter-scott/README | 1 + challenge-277/petr-roubicek/README | 1 + challenge-277/philippe-bruhat/README | 1 + challenge-277/phillip-harris/README | 1 + challenge-277/pip/README | 1 + challenge-277/pjdurai/README | 1 + challenge-277/pkmnx/README | 1 + challenge-277/plis-acm/.gitignore | 1 + challenge-277/plis-acm/README | 1 + challenge-277/pokgopun/README | 1 + challenge-277/polettix/README | 1 + challenge-277/polettix/perl/.gitignore | 1 + challenge-277/polettix/raku/.leaveme | 0 challenge-277/prajith-p/README | 1 + challenge-277/princy-perl/README | 1 + challenge-277/probablyfine/README.md | 1 + challenge-277/rage311/README | 1 + challenge-277/rakulius/README | 1 + challenge-277/randy-lauen/README | 1 + challenge-277/rawleyfowler/README.md | 5 + challenge-277/razetime/README | 1 + challenge-277/rcmlz/README | 1 + challenge-277/reinier-maliepaard/README | 1 + challenge-277/ribtips/README | 1 + challenge-277/richard-park/README | 1 + challenge-277/rick-bychowski/README | 1 + challenge-277/rnuttall/README | 1 + challenge-277/rob-van-dam/README | 1 + challenge-277/rob4t/README | 1 + challenge-277/robbie-hatley/README | 1 + challenge-277/robert-dicicco/README | 1 + challenge-277/robert-mcintosh/README | 1 + challenge-277/roger-bell-west/README | 1 + challenge-277/rozcovo/README | 1 + challenge-277/ruben-westerberg/README | 9 + challenge-277/ryan-thompson/README.md | 17 + challenge-277/saiftynet/README | 1 + challenge-277/samir-parikh/README | 1 + challenge-277/sangeet-kar/README | 1 + challenge-277/santiago-leyva/README | 1 + challenge-277/sean-meininger/README | 1 + challenge-277/sergiotarxz/README | 1 + challenge-277/sgreen/README.md | 3 + challenge-277/shahed-nooshmand/README | 1 + challenge-277/shardiwal/README | 1 + challenge-277/shaun-pearce/README | 1 + challenge-277/shawak/README.md | 1 + challenge-277/shawn-wagner/README | 1 + challenge-277/shimon-ben-avraham/README | 1 + challenge-277/simon-dueck/README | 1 + challenge-277/simon-miner/README | 1 + challenge-277/simon-proctor/README | 1 + challenge-277/simon-reinhardt/README | 1 + challenge-277/sol-demuth/README | 1 + challenge-277/solathian/README | 1 + challenge-277/southpawgeek/README | 1 + challenge-277/spadacciniweb/README | 1 + challenge-277/spazm/README | 1 + challenge-277/stephanie-stein/README | 1 + challenge-277/steve-bresson/README | 1 + challenge-277/steve-g-lynn/README | 1 + challenge-277/steve-rogerson/README | 1 + challenge-277/steven-lembark/README | 1 + challenge-277/steven-wilson/README | 1 + challenge-277/stuart-little/README | 1 + challenge-277/svetlana-nesterova/README | 1 + challenge-277/swaggboi/README | 1 + challenge-277/szabgab/README | 1 + challenge-277/ted-leahy/README | 1 + challenge-277/testerR59/README | 1 + challenge-277/tiago-stock/README | 1 + challenge-277/tim-potapov/README | 1 + challenge-277/tim-potapov/perl/.perl-version | 1 + challenge-277/tim-smith/README | 1 + challenge-277/tore-andersson/README | 1 + challenge-277/trenton-langer/README | 1 + challenge-277/tyler-bird/README | 1 + challenge-277/tyler-limkemann/README | 1 + challenge-277/tyler-wardhaugh/README | 1 + challenge-277/tyler-wardhaugh/clojure/.gitignore | 28 ++ challenge-277/tyler-wardhaugh/clojure/LICENSE | 214 +++++++++++++ challenge-277/tyler-wardhaugh/clojure/README.md | 41 +++ challenge-277/tyler-wardhaugh/clojure/bb.edn | 68 ++++ challenge-277/tyler-wardhaugh/clojure/deps.edn | 15 + .../tyler-wardhaugh/clojure/resources/.keep | 0 challenge-277/tyler-wardhaugh/fennel/.gitignore | 1 + challenge-277/tyler-wardhaugh/python/.gitignore | 24 ++ challenge-277/ulrich-rieke/README | 1 + challenge-277/user-person/README | 1 + challenge-277/uzluisf/README | 1 + challenge-277/vamsi-meenavilli/README | 1 + challenge-277/veesh-goldman/README | 1 + challenge-277/vinod-k/README | 1 + challenge-277/vinod-pal/README | 1 + challenge-277/vyacheslav-volgarev/README | 1 + challenge-277/walt-mankowski/README.md | 41 +++ challenge-277/walt-mankowski/c/.gitignore | 2 + challenge-277/walt-mankowski/cpp/.gitignore | 2 + challenge-277/walt-mankowski/perl/.perl-version | 1 + .../walt-mankowski/python/.python-version | 1 + challenge-277/wambash/README | 1 + challenge-277/wanderdoc/README | 1 + challenge-277/wg-romank/README | 1 + challenge-277/will-west/README | 1 + challenge-277/william-gilmore/README | 1 + challenge-277/witawayar/README | 1 + challenge-277/wlmb/README | 1 + challenge-277/x1mandi/README | 1 + challenge-277/xkr47/README | 11 + challenge-277/xliff/README | 1 + challenge-277/yary-h/README | 1 + challenge-277/yet-ebreo/README | 1 + challenge-277/yozen-hernandez/README | 1 + challenge-277/zapwai/README | 1 + challenge-277/ziameraj16/README.md | 18 ++ challenge-277/ziruzavar/README | 1 + 356 files changed, 1757 insertions(+) create mode 100644 challenge-277/0rir/README create mode 100644 challenge-277/2colours/README create mode 100644 challenge-277/3ter/README create mode 100755 challenge-277/LoneWolfiNTj/README create mode 100644 challenge-277/aaron-rowe/README create mode 100644 challenge-277/aaron-sherman/README create mode 100644 challenge-277/aaronreidsmith/README create mode 100644 challenge-277/abigail/README.md create mode 100644 challenge-277/adam-russell/.gitignore create mode 100644 challenge-277/adam-russell/README create mode 100644 challenge-277/adherzog/README create mode 100644 challenge-277/adriaandens/README create mode 100644 challenge-277/aecepoglu/README create mode 100644 challenge-277/ailbhe-tweedie/README create mode 100644 challenge-277/alex-daniel/README create mode 100644 challenge-277/alexander-karelas/README create mode 100644 challenge-277/alexander-pankoff/README create mode 100644 challenge-277/alicia-bielsa/README create mode 100644 challenge-277/andinus/README create mode 100644 challenge-277/andreas-voegele/README create mode 100644 challenge-277/andrezgz/README create mode 100644 challenge-277/anton-fedotov/README create mode 100644 challenge-277/antonio-gamiz/README create mode 100644 challenge-277/ap29600/README create mode 100644 challenge-277/archargelod/README create mode 100644 challenge-277/arne-sommer/README create mode 100644 challenge-277/arpad-toth/README create mode 100644 challenge-277/ash/README create mode 100644 challenge-277/asherbhs/README create mode 100644 challenge-277/asherbhs/hy/.gitignore create mode 100644 challenge-277/athanasius/README create mode 100644 challenge-277/atschneid/README.md create mode 100644 challenge-277/aubrey-quarcoo/README create mode 100644 challenge-277/augiedb/README create mode 100644 challenge-277/aut0exec/README create mode 100644 challenge-277/avery-adams/README create mode 100644 challenge-277/aviral-goel/README create mode 100644 challenge-277/barroff/README create mode 100644 challenge-277/baryshevs/README create mode 100644 challenge-277/bejoy-mathews/README create mode 100644 challenge-277/belmark-caday/README create mode 100644 challenge-277/ben-davies/README.md create mode 100644 challenge-277/bhat_gurunandan/README create mode 100644 challenge-277/bill-palmer/README create mode 100644 challenge-277/bkb/README create mode 100644 challenge-277/bn-ssotka/README create mode 100644 challenge-277/bob-kleemann/README create mode 100644 challenge-277/bob-lied/README create mode 100644 challenge-277/brtastic/README create mode 100644 challenge-277/brtastic/c/.gitignore create mode 100644 challenge-277/brtastic/pascal/.gitignore create mode 100644 challenge-277/bruce-gray/README create mode 100644 challenge-277/bruno-ramos/README create mode 100644 challenge-277/brxfork/README create mode 100644 challenge-277/burkhard-nickels/README create mode 100644 challenge-277/bwva/README create mode 100644 challenge-277/carlos-oliveira/README create mode 100644 challenge-277/chazzka/README create mode 100644 challenge-277/cheok-yin-fung/README create mode 100644 challenge-277/chicagoist/README.md create mode 100644 challenge-277/christian-jaeger/README create mode 100644 challenge-277/clifton-wood/README create mode 100644 challenge-277/cliveholloway/README create mode 100644 challenge-277/colin-crain/README create mode 100644 challenge-277/conor-hoekstra/README create mode 100644 challenge-277/craig/README create mode 100644 challenge-277/creewick/README create mode 100644 challenge-277/cristian-heredia/README create mode 100644 challenge-277/cybersnyder/README create mode 100644 challenge-277/dan-friedman/README create mode 100644 challenge-277/daniel-aberger/README create mode 100644 challenge-277/daniel-mantovani/README create mode 100644 challenge-277/daniel-mita/README create mode 100644 challenge-277/daniel-pfeiffer/README create mode 100644 challenge-277/dario-mazzeo/README create mode 100644 challenge-277/darren-bottin/README create mode 100644 challenge-277/dave-cross/README create mode 100644 challenge-277/dave-jacoby/README create mode 100644 challenge-277/david-kayal/README create mode 100644 challenge-277/david-santiago/README create mode 100644 challenge-277/ddobbelaere/README create mode 100644 challenge-277/deadmarshal/README create mode 100644 challenge-277/demerphq/README create mode 100644 challenge-277/demerphq/js/.gitignore create mode 100644 challenge-277/denis-yurashku/README create mode 100644 challenge-277/dms061/readme create mode 100644 challenge-277/donald-hunter/README create mode 100644 challenge-277/doug-schrag/README create mode 100644 challenge-277/dracos/README create mode 100644 challenge-277/duane-powell/README create mode 100644 challenge-277/duncan-c-white/C/.cbuild create mode 100644 challenge-277/duncan-c-white/README create mode 100644 challenge-277/e-choroba/README create mode 100644 challenge-277/ealvar3z/README create mode 100644 challenge-277/eddy-hs/README create mode 100644 challenge-277/eric-cheung/README create mode 100644 challenge-277/fabrizio-poggi/README create mode 100644 challenge-277/feng-chang/README.md create mode 100644 challenge-277/finanalyst/README create mode 100644 challenge-277/finley/README create mode 100644 challenge-277/fjwhittle/README create mode 100644 challenge-277/frankivo/README create mode 100644 challenge-277/fred-zinn/README create mode 100644 challenge-277/freddie-b/README create mode 100644 challenge-277/garrett-goebel/README create mode 100644 challenge-277/giuseppe-terlizzi/README create mode 100644 challenge-277/gugod/README create mode 100644 challenge-277/gugod/rust/.gitignore create mode 100644 challenge-277/guillermo-ramos/README create mode 100644 challenge-277/gustavo-chaves/README create mode 100644 challenge-277/habere-et-dispetire/README create mode 100644 challenge-277/happy-barney/README create mode 100644 challenge-277/hatorikibble/README create mode 100644 challenge-277/hauke-d/README create mode 100644 challenge-277/henry-wong/README create mode 100644 challenge-277/hstejas/README create mode 100644 challenge-277/iangoodnight/README.md create mode 100644 challenge-277/iangoodnight/python/.gitignore create mode 100644 challenge-277/ianrifkin/README.md create mode 100644 challenge-277/izem/README create mode 100644 challenge-277/izifresh/README create mode 100644 challenge-277/jacques-guinnebault/README create mode 100644 challenge-277/jaguart/README.md create mode 100644 challenge-277/jaime/README create mode 100644 challenge-277/jake/README create mode 100644 challenge-277/jaldhar-h-vyas/README create mode 100644 challenge-277/james-marquis/README create mode 100644 challenge-277/james-raspass/README create mode 100644 challenge-277/james-smith/README.md create mode 100644 challenge-277/jan-perl/README create mode 100644 challenge-277/jaredor/README create mode 100644 challenge-277/jason-messer/README create mode 100644 challenge-277/javier-luque/README create mode 100644 challenge-277/jbourlakos/README create mode 100644 challenge-277/jcrosswh/README create mode 100644 challenge-277/jdos22/README create mode 100644 challenge-277/jeanluc2020/README create mode 100644 challenge-277/jeff/README create mode 100644 challenge-277/jeongoon/.gitignore create mode 100644 challenge-277/jeongoon/README create mode 100644 challenge-277/jeremy-carman/README create mode 100644 challenge-277/jim-bacon/README create mode 100644 challenge-277/jitu-keshwani/README create mode 100644 challenge-277/jj-merelo/README create mode 100644 challenge-277/jluis/README create mode 100644 challenge-277/jo-37/README create mode 100644 challenge-277/jo-christian-oterhals/README create mode 100644 challenge-277/joaofel/README create mode 100644 challenge-277/joe-tym/README create mode 100644 challenge-277/joelle-maslak/README create mode 100644 challenge-277/john-barrett/README create mode 100644 challenge-277/john-horner/README create mode 100644 challenge-277/jokraft/README create mode 100644 challenge-277/juan-caballero/README create mode 100644 challenge-277/julien-fiegehenn/README create mode 100644 challenge-277/julien-fiegehenn/perl/.gitignore create mode 100644 challenge-277/julien-fiegehenn/typescript/.gitignore create mode 100644 challenge-277/julien-fiegehenn/typescript/.nvmrc create mode 100644 challenge-277/juliodcs/README create mode 100644 challenge-277/kai-burgdorf/README.md create mode 100644 challenge-277/kaushik-tunuguntla/README create mode 100644 challenge-277/kevin-colyer/README create mode 100644 challenge-277/khalid-anwar/README create mode 100644 challenge-277/khalid/README create mode 100644 challenge-277/kian-meng-ang/README create mode 100644 challenge-277/kiran-kumar/README create mode 100644 challenge-277/kivanc-yazan/.gitignore create mode 100644 challenge-277/kivanc-yazan/README create mode 100644 challenge-277/kjetillll/README create mode 100644 challenge-277/kordaff/README create mode 100644 challenge-277/kostas-giannakakis/README create mode 100644 challenge-277/kueppo-wesley/README create mode 100644 challenge-277/kurkale6ka/README create mode 100644 challenge-277/lacek96/README create mode 100644 challenge-277/lance-wicks/README create mode 100644 challenge-277/lars-balker/README create mode 100644 challenge-277/lars-thegler/README create mode 100644 challenge-277/laurent-rosenfeld/README create mode 100644 challenge-277/leoltron/README create mode 100644 challenge-277/librasteve/README create mode 100644 challenge-277/lubos-kolouch/README create mode 100644 challenge-277/luc65r/README create mode 100644 challenge-277/luca-ferrari/pljava/pom.xml create mode 100644 challenge-277/luiz-felipe/README create mode 100644 challenge-277/macy-ty/README create mode 100644 challenge-277/magnus-woldrich/README create mode 100644 challenge-277/manfredi/README create mode 100644 challenge-277/mano-chandar/README create mode 100644 challenge-277/mark-anderson/README create mode 100644 challenge-277/mark-senn/README create mode 100644 challenge-277/markjreed/README create mode 100644 challenge-277/markus-holzer/README create mode 100644 challenge-277/martin-barth/README create mode 100644 challenge-277/martin-mugeni/README create mode 100644 challenge-277/massa/README create mode 100644 challenge-277/mathmauney/README create mode 100644 challenge-277/matt-latusek/README create mode 100644 challenge-277/matthew-persico/README create mode 100644 challenge-277/matthias-muth/README.md create mode 100644 challenge-277/mattneleigh/README create mode 100644 challenge-277/mauke/README create mode 100644 challenge-277/maxim-kolodyazhny/README create mode 100644 challenge-277/maxim-nechaev/README create mode 100644 challenge-277/memark/README create mode 100644 challenge-277/mgo1977/README create mode 100644 challenge-277/michael-hamlin/README create mode 100644 challenge-277/michael-schaap/README create mode 100644 challenge-277/mihail-iosilevitch/README create mode 100644 challenge-277/mike-accardo/README create mode 100644 challenge-277/mimosinnet/README create mode 100644 challenge-277/mohammad-anwar/README create mode 100644 challenge-277/morayj/README create mode 100644 challenge-277/ndelucca/README create mode 100644 challenge-277/neil-bowers/README create mode 100644 challenge-277/nelo-tovar/README.md create mode 100644 challenge-277/nick-logan/README create mode 100644 challenge-277/nicolas-mendoza/README create mode 100644 challenge-277/nikhil-prasanna/README create mode 100644 challenge-277/noud/README create mode 100644 challenge-277/nunovieira220/README create mode 100644 challenge-277/ohmycloud/README create mode 100644 challenge-277/oleksii-tsvietnov/README create mode 100644 challenge-277/oliver-oviedo/README create mode 100644 challenge-277/olivier-delouya/README create mode 100644 challenge-277/olli-antti/README create mode 100644 challenge-277/orestis-zekai/README create mode 100644 challenge-277/ozzy/README create mode 100644 challenge-277/p6steve/README create mode 100644 challenge-277/pablo-saavedra/README create mode 100644 challenge-277/packy-anderson/README.md create mode 100644 challenge-277/paul-fajman/README create mode 100644 challenge-277/paulo-custodio/README create mode 100644 challenge-277/pavel-jurca/README create mode 100644 challenge-277/pavel-starikov/README create mode 100644 challenge-277/pavel_kuptsov/README create mode 100644 challenge-277/perlboy1967/README create mode 100644 challenge-277/pete-houston/README create mode 100644 challenge-277/pete-sergeant/README create mode 100644 challenge-277/peter-campbell-smith/README create mode 100644 challenge-277/peter-meszaros/README create mode 100644 challenge-277/peter-scott/README create mode 100644 challenge-277/petr-roubicek/README create mode 100644 challenge-277/philippe-bruhat/README create mode 100644 challenge-277/phillip-harris/README create mode 100644 challenge-277/pip/README create mode 100644 challenge-277/pjdurai/README create mode 100644 challenge-277/pkmnx/README create mode 100644 challenge-277/plis-acm/.gitignore create mode 100644 challenge-277/plis-acm/README create mode 100644 challenge-277/pokgopun/README create mode 100644 challenge-277/polettix/README create mode 100644 challenge-277/polettix/perl/.gitignore create mode 100644 challenge-277/polettix/raku/.leaveme create mode 100644 challenge-277/prajith-p/README create mode 100644 challenge-277/princy-perl/README create mode 100644 challenge-277/probablyfine/README.md create mode 100644 challenge-277/rage311/README create mode 100644 challenge-277/rakulius/README create mode 100644 challenge-277/randy-lauen/README create mode 100644 challenge-277/rawleyfowler/README.md create mode 100644 challenge-277/razetime/README create mode 100644 challenge-277/rcmlz/README create mode 100644 challenge-277/reinier-maliepaard/README create mode 100644 challenge-277/ribtips/README create mode 100644 challenge-277/richard-park/README create mode 100644 challenge-277/rick-bychowski/README create mode 100644 challenge-277/rnuttall/README create mode 100644 challenge-277/rob-van-dam/README create mode 100644 challenge-277/rob4t/README create mode 100644 challenge-277/robbie-hatley/README create mode 100644 challenge-277/robert-dicicco/README create mode 100644 challenge-277/robert-mcintosh/README create mode 100644 challenge-277/roger-bell-west/README create mode 100644 challenge-277/rozcovo/README create mode 100644 challenge-277/ruben-westerberg/README create mode 100644 challenge-277/ryan-thompson/README.md create mode 100644 challenge-277/saiftynet/README create mode 100644 challenge-277/samir-parikh/README create mode 100644 challenge-277/sangeet-kar/README create mode 100644 challenge-277/santiago-leyva/README create mode 100644 challenge-277/sean-meininger/README create mode 100644 challenge-277/sergiotarxz/README create mode 100644 challenge-277/sgreen/README.md create mode 100644 challenge-277/shahed-nooshmand/README create mode 100644 challenge-277/shardiwal/README create mode 100644 challenge-277/shaun-pearce/README create mode 100644 challenge-277/shawak/README.md create mode 100644 challenge-277/shawn-wagner/README create mode 100644 challenge-277/shimon-ben-avraham/README create mode 100644 challenge-277/simon-dueck/README create mode 100644 challenge-277/simon-miner/README create mode 100644 challenge-277/simon-proctor/README create mode 100644 challenge-277/simon-reinhardt/README create mode 100644 challenge-277/sol-demuth/README create mode 100644 challenge-277/solathian/README create mode 100644 challenge-277/southpawgeek/README create mode 100644 challenge-277/spadacciniweb/README create mode 100644 challenge-277/spazm/README create mode 100644 challenge-277/stephanie-stein/README create mode 100644 challenge-277/steve-bresson/README create mode 100644 challenge-277/steve-g-lynn/README create mode 100644 challenge-277/steve-rogerson/README create mode 100644 challenge-277/steven-lembark/README create mode 100644 challenge-277/steven-wilson/README create mode 100644 challenge-277/stuart-little/README create mode 100644 challenge-277/svetlana-nesterova/README create mode 100644 challenge-277/swaggboi/README create mode 100644 challenge-277/szabgab/README create mode 100644 challenge-277/ted-leahy/README create mode 100644 challenge-277/testerR59/README create mode 100644 challenge-277/tiago-stock/README create mode 100644 challenge-277/tim-potapov/README create mode 100644 challenge-277/tim-potapov/perl/.perl-version create mode 100644 challenge-277/tim-smith/README create mode 100644 challenge-277/tore-andersson/README create mode 100644 challenge-277/trenton-langer/README create mode 100644 challenge-277/tyler-bird/README create mode 100644 challenge-277/tyler-limkemann/README create mode 100644 challenge-277/tyler-wardhaugh/README create mode 100644 challenge-277/tyler-wardhaugh/clojure/.gitignore create mode 100644 challenge-277/tyler-wardhaugh/clojure/LICENSE create mode 100644 challenge-277/tyler-wardhaugh/clojure/README.md create mode 100644 challenge-277/tyler-wardhaugh/clojure/bb.edn create mode 100644 challenge-277/tyler-wardhaugh/clojure/deps.edn create mode 100644 challenge-277/tyler-wardhaugh/clojure/resources/.keep create mode 100644 challenge-277/tyler-wardhaugh/fennel/.gitignore create mode 100644 challenge-277/tyler-wardhaugh/python/.gitignore create mode 100644 challenge-277/ulrich-rieke/README create mode 100644 challenge-277/user-person/README create mode 100644 challenge-277/uzluisf/README create mode 100644 challenge-277/vamsi-meenavilli/README create mode 100644 challenge-277/veesh-goldman/README create mode 100644 challenge-277/vinod-k/README create mode 100644 challenge-277/vinod-pal/README create mode 100644 challenge-277/vyacheslav-volgarev/README create mode 100644 challenge-277/walt-mankowski/README.md create mode 100644 challenge-277/walt-mankowski/c/.gitignore create mode 100644 challenge-277/walt-mankowski/cpp/.gitignore create mode 100644 challenge-277/walt-mankowski/perl/.perl-version create mode 100644 challenge-277/walt-mankowski/python/.python-version create mode 100644 challenge-277/wambash/README create mode 100644 challenge-277/wanderdoc/README create mode 100644 challenge-277/wg-romank/README create mode 100644 challenge-277/will-west/README create mode 100644 challenge-277/william-gilmore/README create mode 100644 challenge-277/witawayar/README create mode 100644 challenge-277/wlmb/README create mode 100644 challenge-277/x1mandi/README create mode 100644 challenge-277/xkr47/README create mode 100644 challenge-277/xliff/README create mode 100644 challenge-277/yary-h/README create mode 100644 challenge-277/yet-ebreo/README create mode 100644 challenge-277/yozen-hernandez/README create mode 100644 challenge-277/zapwai/README create mode 100755 challenge-277/ziameraj16/README.md create mode 100644 challenge-277/ziruzavar/README diff --git a/challenge-277/0rir/README b/challenge-277/0rir/README new file mode 100644 index 0000000000..48ee4684c2 --- /dev/null +++ b/challenge-277/0rir/README @@ -0,0 +1,2 @@ + +Solution by Robert Ransbottom. diff --git a/challenge-277/2colours/README b/challenge-277/2colours/README new file mode 100644 index 0000000000..6894fbec08 --- /dev/null +++ b/challenge-277/2colours/README @@ -0,0 +1 @@ +Solution By Márton Polgár. diff --git a/challenge-277/3ter/README b/challenge-277/3ter/README new file mode 100644 index 0000000000..8c594431f3 --- /dev/null +++ b/challenge-277/3ter/README @@ -0,0 +1 @@ +Solutions by 3ter. diff --git a/challenge-277/LoneWolfiNTj/README b/challenge-277/LoneWolfiNTj/README new file mode 100755 index 0000000000..bf42ad2482 --- /dev/null +++ b/challenge-277/LoneWolfiNTj/README @@ -0,0 +1 @@ +Solution by Robbie Hatley (github user "LoneWolfiNTj"). \ No newline at end of file diff --git a/challenge-277/aaron-rowe/README b/challenge-277/aaron-rowe/README new file mode 100644 index 0000000000..e14e0782fb --- /dev/null +++ b/challenge-277/aaron-rowe/README @@ -0,0 +1 @@ +Solutions by Aaron Rowe. diff --git a/challenge-277/aaron-sherman/README b/challenge-277/aaron-sherman/README new file mode 100644 index 0000000000..14ec31f570 --- /dev/null +++ b/challenge-277/aaron-sherman/README @@ -0,0 +1 @@ +Solutions by Aaron Sherman. diff --git a/challenge-277/aaronreidsmith/README b/challenge-277/aaronreidsmith/README new file mode 100644 index 0000000000..2fcfe1fdcc --- /dev/null +++ b/challenge-277/aaronreidsmith/README @@ -0,0 +1 @@ +Solution by Aaron Smith diff --git a/challenge-277/abigail/README.md b/challenge-277/abigail/README.md new file mode 100644 index 0000000000..d22640a6ce --- /dev/null +++ b/challenge-277/abigail/README.md @@ -0,0 +1 @@ +# Solutions by Abigail. diff --git a/challenge-277/adam-russell/.gitignore b/challenge-277/adam-russell/.gitignore new file mode 100644 index 0000000000..d4e9a94d5e --- /dev/null +++ b/challenge-277/adam-russell/.gitignore @@ -0,0 +1,3 @@ +*.bbprojectd +.RData +.Rhistory diff --git a/challenge-277/adam-russell/README b/challenge-277/adam-russell/README new file mode 100644 index 0000000000..1d2e2957c5 --- /dev/null +++ b/challenge-277/adam-russell/README @@ -0,0 +1 @@ +Solution by Adam Russell diff --git a/challenge-277/adherzog/README b/challenge-277/adherzog/README new file mode 100644 index 0000000000..b59913be6c --- /dev/null +++ b/challenge-277/adherzog/README @@ -0,0 +1 @@ +Solutions by Adam Herzog. diff --git a/challenge-277/adriaandens/README b/challenge-277/adriaandens/README new file mode 100644 index 0000000000..60d4ec3943 --- /dev/null +++ b/challenge-277/adriaandens/README @@ -0,0 +1 @@ +Solutions by Adriaan Dens. diff --git a/challenge-277/aecepoglu/README b/challenge-277/aecepoglu/README new file mode 100644 index 0000000000..9e57c3a464 --- /dev/null +++ b/challenge-277/aecepoglu/README @@ -0,0 +1,3 @@ +Solution by AhmetEmre + +Solved live on twitch.tv/slippygoat diff --git a/challenge-277/ailbhe-tweedie/README b/challenge-277/ailbhe-tweedie/README new file mode 100644 index 0000000000..36d4034b70 --- /dev/null +++ b/challenge-277/ailbhe-tweedie/README @@ -0,0 +1 @@ +Solution by Ailbhe Tweedie diff --git a/challenge-277/alex-daniel/README b/challenge-277/alex-daniel/README new file mode 100644 index 0000000000..65550789bd --- /dev/null +++ b/challenge-277/alex-daniel/README @@ -0,0 +1 @@ +Solution by Alex Daniel. diff --git a/challenge-277/alexander-karelas/README b/challenge-277/alexander-karelas/README new file mode 100644 index 0000000000..3de9fce8d9 --- /dev/null +++ b/challenge-277/alexander-karelas/README @@ -0,0 +1 @@ +Solution by Alexander Karelas diff --git a/challenge-277/alexander-pankoff/README b/challenge-277/alexander-pankoff/README new file mode 100644 index 0000000000..41f67807ac --- /dev/null +++ b/challenge-277/alexander-pankoff/README @@ -0,0 +1 @@ +Solution by Alexander Pankoff diff --git a/challenge-277/alicia-bielsa/README b/challenge-277/alicia-bielsa/README new file mode 100644 index 0000000000..c5187874c3 --- /dev/null +++ b/challenge-277/alicia-bielsa/README @@ -0,0 +1 @@ +Solution by Alicia Beilsa. diff --git a/challenge-277/andinus/README b/challenge-277/andinus/README new file mode 100644 index 0000000000..ad1a4a32fa --- /dev/null +++ b/challenge-277/andinus/README @@ -0,0 +1,69 @@ + ━━━━━━━━━━━━━━━ + CHALLENGE 188 + + Andinus + ━━━━━━━━━━━━━━━ + + + 2022-10-27 + + + + + +1 Task 1 - Divisible Pairs +══════════════════════════ + + You are given list of integers @list of size $n and divisor $k. + + Write a script to find out count of pairs in the given list that + satisfies the following rules. + + The pair (i, j) is eligible if and only if a) 0 <= i < j < len(list) + b) list[i] + list[j] is divisible by k + + + ┌──── + │ Example 1 + │ Input: @list = (4, 5, 1, 6), $k = 2 + │ Output: 2 + │ + │ Example 2 + │ Input: @list = (1, 2, 3, 4), $k = 2 + │ Output: 2 + │ + │ Example 3 + │ Input: @list = (1, 3, 4, 5), $k = 3 + │ Output: 2 + │ + │ Example 4 + │ Input: @list = (5, 1, 2, 3), $k = 4 + │ Output: 2 + │ + │ Example 5 + │ Input: @list = (7, 2, 4, 5), $k = 4 + │ Output: 1 + └──── + + +1.1 Raku +──────── + + Go over all combinations of elements as per rules and check if their + sum is divisible by divisor. + + ┌──── + │ unit sub MAIN( + │ Int $divisor, *@list is copy where *.elems > 0 + │ ); + │ @list = @list>>.Int; + │ + │ my Int $pairs; + │ for 0 ... @list.end -> $i { + │ for $i ... @list.end -> $j { + │ next if $i == $j; + │ $pairs++ if (@list[$i] + @list[$j]) %% $divisor; + │ } + │ } + │ put $pairs; + └──── diff --git a/challenge-277/andreas-voegele/README b/challenge-277/andreas-voegele/README new file mode 100644 index 0000000000..da9f91b22a --- /dev/null +++ b/challenge-277/andreas-voegele/README @@ -0,0 +1 @@ +Solutions by Andreas Vögele. diff --git a/challenge-277/andrezgz/README b/challenge-277/andrezgz/README new file mode 100644 index 0000000000..f4fd0da88e --- /dev/null +++ b/challenge-277/andrezgz/README @@ -0,0 +1 @@ +Solution by Andrezgz diff --git a/challenge-277/anton-fedotov/README b/challenge-277/anton-fedotov/README new file mode 100644 index 0000000000..f7c4f6deed --- /dev/null +++ b/challenge-277/anton-fedotov/README @@ -0,0 +1 @@ +Solutions by Anton Fedotov. diff --git a/challenge-277/antonio-gamiz/README b/challenge-277/antonio-gamiz/README new file mode 100644 index 0000000000..1f5ed5871a --- /dev/null +++ b/challenge-277/antonio-gamiz/README @@ -0,0 +1 @@ +Solution by Antonio Gamiz diff --git a/challenge-277/ap29600/README b/challenge-277/ap29600/README new file mode 100644 index 0000000000..003f354c89 --- /dev/null +++ b/challenge-277/ap29600/README @@ -0,0 +1 @@ +Solutions by Andrea Piseri diff --git a/challenge-277/archargelod/README b/challenge-277/archargelod/README new file mode 100644 index 0000000000..6cd57e1074 --- /dev/null +++ b/challenge-277/archargelod/README @@ -0,0 +1 @@ +Solution by archargelod diff --git a/challenge-277/arne-sommer/README b/challenge-277/arne-sommer/README new file mode 100644 index 0000000000..b5d88e4df4 --- /dev/null +++ b/challenge-277/arne-sommer/README @@ -0,0 +1 @@ +Solution by Arne Sommer. diff --git a/challenge-277/arpad-toth/README b/challenge-277/arpad-toth/README new file mode 100644 index 0000000000..6661dd82c1 --- /dev/null +++ b/challenge-277/arpad-toth/README @@ -0,0 +1 @@ +Solution by Arpad Toth diff --git a/challenge-277/ash/README b/challenge-277/ash/README new file mode 100644 index 0000000000..318b1bfb41 --- /dev/null +++ b/challenge-277/ash/README @@ -0,0 +1 @@ +Solutions by Andrew Shitov diff --git a/challenge-277/asherbhs/README b/challenge-277/asherbhs/README new file mode 100644 index 0000000000..5c37138bd7 --- /dev/null +++ b/challenge-277/asherbhs/README @@ -0,0 +1 @@ +Solutions by Asher Harvey-Smith diff --git a/challenge-277/asherbhs/hy/.gitignore b/challenge-277/asherbhs/hy/.gitignore new file mode 100644 index 0000000000..bee8a64b79 --- /dev/null +++ b/challenge-277/asherbhs/hy/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/challenge-277/athanasius/README b/challenge-277/athanasius/README new file mode 100644 index 0000000000..cc357fda4a --- /dev/null +++ b/challenge-277/athanasius/README @@ -0,0 +1 @@ +Solution by Athanasius diff --git a/challenge-277/atschneid/README.md b/challenge-277/atschneid/README.md new file mode 100644 index 0000000000..5b6e48eed2 --- /dev/null +++ b/challenge-277/atschneid/README.md @@ -0,0 +1,343 @@ +# Completed and Maximum Frequency Days + +**Challenge 276 solutions by Andrew Schneider** + +[PWC 276](https://theweeklychallenge.org/blog/perl-weekly-challenge-276/) + +PWC 276 Back on Track! + +Two Challenges this week. I thought the first one was easy, but that was because I misread the instructions. The second one had a trick to it too, but I'd say the first one was the hard one, contrary to recent experience. + +## Task 1: Complete Day + +> Task 1: Complete Day
+>
+> Submitted by: Mohammad Sajid Anwar
+>
+> You are given an array of integers, @hours.
+>
+> Write a script to return the number of pairs that forms a complete day.
+>
+> A complete day is defined as a time duration that is an exact multiple of 24 hours.
+>
+> Example 1
+> Input: @hours = (12, 12, 30, 24, 24)
+> Output: 2
+>
+> Pair 1: (12, 12)
+> Pair 2: (24, 24)
+>
+> Example 2
+> Input: @hours = (72, 48, 24, 5)
+> Output: 3
+>
+> Pair 1: (72, 48)
+> Pair 2: (72, 24)
+> Pair 3: (48, 24)
+>
+> Example 3
+> Input: @hours = (12, 18, 24)
+> Output: 0 + +On first reading, I thought we were looking only at adjacent items. So I hacked out a pretty quick solution looking at adjacent pairs of times to see if they summed to a multiple of 24. Easy! and not what we wanted. Oops + +Double checking the examples I saw that we weren't limited to adjacent pairs. Trickier. We could of course check all possible pairs of times for a $\mathcal{O}(n^2)$, but we wouldn't be happy with that! (Actually I my *cleverer* Prolog solution had worse algorithmic runtime than that, due to Prologisms, so I went back to a $\mathcal{O}(n^2)$ solution.) + +So after some thinking and pondering, I made some observations: if $t_1 + t_2 \bmod 24 = 0$ then $(t_1, t_2)$ constitutes a completed day, equivalently if $(t_1 \bmod 24 + t_2 \bmod 24) \bmod 24 = 0$. So we could find all values modulo 24 and figure it out from there. + +Let's see some code + +### C + +My C code has the clearest illustration of my developing thinking, plus all Perl programmers also know C, so let's look at the C solution(s) first. Version 1 here: + +```c +int count_completed_days_v1( int list[], int length ) { + int day_count[24] = {0}; + for (int i=0; i < length; i++) { + day_count[list[i] % 24]++; + } + + int count = day_count[0] * (day_count[0] - 1) / 2; + count += day_count[12] * (day_count[12] - 1) / 2; + for (int i=1; i < 12; i++) { + count += day_count[i] * day_count[24-i]; + } + return count; +} +``` + +We go through the list and count how many at each value mod 24. Then ... well then we do some tricky math. There are two values we need to take special care of: 0 and 12. Let's hold off on explaining those for the moment and move on the second loop. + +```c + for (int i=1; i < 12; i++) { + count += day_count[i] * day_count[24-i]; + } +``` + +Skipping 0 and 12 we run this loop from 1 through 11 inclusive. The idea here is that for all hours that modulo to a certain value, we can complete a day by adding any of the hours that modulo to the reciprococal value. So like if we have 5 instances with 1 hour (or 1 hour after modulo 24) and 2 instances with 23 hours (or equivalent mod 24), then from these we can make $5 \times 2 = 10$ completed days. Also, we only go up to 11 so we don't double count, since a pair of $(t_1, t_2) = (t_2, t_1)$. Double count, actually that is why we treat 0 and 12 specially. + +See for 0 and 12, they are their own reciprocals. So we have to do some clever maths. Thinking back to my school days, and getting out the pencil and paper, the proper way to sum these is n choose 2, ie, $\binom{n}2$, in code: + +```c + int count = day_count[0] * (day_count[0] - 1) / 2; + count += day_count[12] * (day_count[12] - 1) / 2; +``` + +Boom done. Except... is there a better way to do it? This way I have two loops, plus some tricky mathy stuff. Well ... yes! there is a better algorithm in every conceivable way: more direct and more efficient. + +```c +int count_completed_days( int list[], int length ) { + int count = 0; + int day_count[24] = {0}; + for (int i=0; i < length; i++) { + count += day_count[(24 - list[i] % 24) % 24]; + day_count[list[i] % 24]++; + } + return count; +} +``` + +Here, for every value, we check how many of its reciprocal we have seen so far, and add this number to our total. Then we increment the number of the value. Easy! Loop once through the input and done. And no special thought needed to avoid double counting. + +With the previous algorithm we implicitly ordered (at least mentally) pairs as (lower, higher). Here we kind of order them (occurs later in list, occurs earlier). If this doesn't make any sense to you then don't think too hard about it. It is just kind of how I think about it. + +That extra modulo `(24 - list[i] % 24) % 24` is there to handle the case of `list[i] % 24` which is 0 and $24 - 0 = 24$ when we want it to map to 0, so I do an extra mod. + +### Perl + +This one loop solution is basically what I did in C using a hashmap instead of an array. + +```perl +sub check_completed_days( @hours ) { + no warnings 'uninitialized'; + + my $count; + my %hours_rem_count; + for (@hours) { + my $idx = $_ % 24; + my $inverse_idx = (24 - $idx) % 24; + $count += $hours_rem_count{ $inverse_idx }; + ++$hours_rem_count{ $idx }; + } + return $count; +} +``` + +The hashmap holds our moduli and reciprocals. + +For my C solution, I spent some time trying to get glib.c running on macOS before deciding an array of size 24 (or 240, or 2400, ...) really shouldn't be a problem in C, but since hashmaps are easy in Perl, do what's easy. + +I had to `no warnings 'uninitialized';` since I have `use warnings; use strict;` above, and here I want to treat unseen keys as having value 0. That surprised me a little since apparently we can increment uninitialized values without issue, but I can see some sense in it. The latter case is surely much more common, and would seem more likely to be intended behavior, not a bug. + +### Prolog + +I spent much time hacking together a series of of helper functions to shoehorn my Perl algorithm into Prolog, but at seemingly every step I had to iterate completely through a list, so there was surely no savings to be had using an *efficient* algorithm. Largely to blame is my insistence on writing for GProlog. Maybe next time around I'll target SWI-Prolog, the Rolls Royce of implementations. + +Anyway, I decided to do the loop inside a loop approach, and coded this up in about 5 minutes. The outer loop takes the head of a list and calls the inner loop function to find how many reciprocals it has within the tail of the list + +```prolog +check_completed_days_v1( [], 0 ). +check_completed_days_v1( [H|T], X ) :- + check_reciprocal_count( H, T, X1 ), + check_completed_days_v1( T, X2 ), + X is X1 + X2. +``` + +And the inner loop function checks (recursively) how many values in the list, when added to value `V`, sum to a multiple of 24. + +```prolog +check_reciprocal_count( _, [], 0 ). +check_reciprocal_count( V, [H|T], X ) :- + 0 =:= (V + H) mod 24, + check_reciprocal_count( V, T, X1 ), + succ(X1, X). +check_reciprocal_count( V, [H|T], X ) :- + 0 =\= (V + H) mod 24, + check_reciprocal_count( V, T, X ). +``` + +Very easy Prolog implementation for this $\mathcal{O}(n^2)$ algorithm. + +## Task 2: Maximum Frequency + +> Task 2: Maximum Frequency
+>
+> Submitted by: Mohammad Sajid Anwar
+>
+> You are given an array of positive integers, @ints.
+>
+> Write a script to return the total number of elements in the given array which have the highest frequency.
+>
+> Example 1
+> Input: @ints = (1, 2, 2, 4, 1, 5)
+> Ouput: 4
+>
+> The maximum frequency is 2.
+> The elements 1 and 2 has the maximum frequency.
+>
+> Example 2
+> Input: @ints = (1, 2, 3, 4, 5)
+> Ouput: 5
+>
+> The maximum frequency is 1.
+> The elements 1, 2, 3, 4 and 5 has the maximum frequency. + +The tricky part to this one, I found, is that we need a couple of loops. First loop over the list to get counts. Then loop over the counts to find the max values. + +### Perl + +```perl +sub max_freq_count( @list ){ + my %counts; + map { ++$counts{ $_ } } @list; + my $max_count = max values %counts; + return $max_count * scalar grep { $_ == $max_count } values %counts; +} +``` + +Create a hashmap for counts and count the occurrence of each unique value. Then find the max of the counts, then effectively find the number of values that have the max value with `scalar grep`. The max value is the number of occurences, so we can multiply this by the number of unique values that occur this many times. Easy! + +And no need to `no warnings 'uninitialized';` here, since we are merely incrementing uninitialized values. + +### C + +Ugh. This one gets a little ugly. Here it would have been very useful to have a convenient hashmap data structure. But I powered through without, relying on an indecent amount of sorting. First the forest, then the trees: + +```c +int cf_func(const void* a, const void* b) { + return *(const int*)a > *(const int*)b ? -1 : 1; +} + +int max_freq_count( int list[], int length ) { + qsort( list, length, sizeof( int ), cf_func ); + + int j = 0; + int current = list[0]; + list[0] = 1; + + for (int i=1; i < length; i++) { + if (list[i] == current) { + list[j]++; + } else { + current = list[i]; + list[++j] = 1; + } + } + + qsort( list, ++j, sizeof( int ), cf_func ); + + int max = list[0]; + int sum = max; + for (int i=1; i <= j; i++) { + if (list[i] == max ) { + sum += max; + } else { + break; + } + } + + return sum; +} +``` + +I define the comparison function so that we sort in descending order. This will be helpful below + +```c +int cf_func(const void* a, const void* b) { + return *(const int*)a > *(const int*)b ? -1 : 1; +} +``` + +Then use this to sort the array. + +```c + qsort( list, length, sizeof( int ), cf_func ); +``` + +This will put all occurrences of the same value next to each other, to facilitate counting. We iterate through the sorted array counting the number of occurrences of each value (using the same array! to show how clever I am). Then we sort this array of counts. + +```c + int j = 0; + int current = list[0]; + list[0] = 1; + + for (int i=1; i < length; i++) { + if (list[i] == current) { + list[j]++; + } else { + current = list[i]; + list[++j] = 1; + } + } + + qsort( list, ++j, sizeof( int ), cf_func ); +``` + +Now the highest count is the first element of the array because of descending ordering. We want to find how many unique values have the highest count, so we iterate along the count array until the value decreases, summing as we go, and this value is our answer. + +```c + int max = list[0]; + int sum = max; + for (int i=1; i <= j; i++) { + if (list[i] == max ) { + sum += max; + } else { + break; + } + } + + return sum; +``` + +### Prolog + +In Prolog the approach is basically the same as in C. + +```prolog +max_freq_count( [], 0 ). +max_freq_count( L, X ) :- + msort( L, L1 ), count_adjacents( L1, L2 ), + msort( L2, L3 ), reverse( L3, L4 ), + head( L4, H ), + count_top( H, L4, X0 ), + X is X0 * H. +``` + +We take a list `L`, sort it to `L1`, count the number of adjacent elements as `L2`. Next we sort `L2` giving `L3`, then reverse that so it is descending => `L4`. Take the first value of `L4` as `H`, the count how many values in the sorted list `L4` are equal to `H`. Times that count by the value `H` and, phew..., done! + +To count the number of adjacent values, I do an old Prolog pattern using arity (number of args) to distinguish two identically named functions: + +```prolog +count_adjacents( [], 0 ). +count_adjacents( [I|T], Out ) :- + count_adjacents( I, T, Out ). + +count_adjacents( _, [], [1] ). +count_adjacents( I, [I|Is], [O|Os] ) :- + count_adjacents( I, Is, [O0|Os] ), succ( O0, O ), !. +count_adjacents( _, [I|Is], [1|Os] ) :- + count_adjacents( I, Is, Os ). +``` + +The 2 arg version (`count_adjacents/2`) is what we expect to be outwardly called, while the 3 arg version is intended to be the internal, recursive function. + +If the list is empty the number of adjacent matching values is 0, otherwise, we take the head of the list, and try matching it against the tail of the list. I start the count at 1 since I have already removed the head from the list passed recursively. As long as the value matches the head, the count gets incremented, otherwise we add a new element to the array for the count of the next found value and recur. + +```prolog +count_top( _, [], 0 ). +count_top( V, [H|_], X ) :- + V =\= H, X is 0, !. +count_top( H, [H|T], X ) :- + count_top( H, T, X0 ), succ( X0, X ). +``` + +To round it out, this function finds the number of consecutive elements in a list, starting from the beginning of the list, that have the value `V`. It recursively checks the first element of the list, and once it finds a value that doesn't match it stops checking. + +Lots of recursive functions in Prolog this week! + +## Conclusion + +Some sneaky tricky challenges this week. I look forward to seeing what's in store for next week, and what appropriate/inappropiate languages I'll randomly select for myself. + +Thanks as always! diff --git a/challenge-277/aubrey-quarcoo/README b/challenge-277/aubrey-quarcoo/README new file mode 100644 index 0000000000..8e63a2c1f5 --- /dev/null +++ b/challenge-277/aubrey-quarcoo/README @@ -0,0 +1 @@ +Solution by Aubrey Quarcoo diff --git a/challenge-277/augiedb/README b/challenge-277/augiedb/README new file mode 100644 index 0000000000..0842edd447 --- /dev/null +++ b/challenge-277/augiedb/README @@ -0,0 +1 @@ +Solution by Augie De Blieck Jr. diff --git a/challenge-277/aut0exec/README b/challenge-277/aut0exec/README new file mode 100644 index 0000000000..eaad94dcc6 --- /dev/null +++ b/challenge-277/aut0exec/README @@ -0,0 +1 @@ +Solution by Aut0exec diff --git a/challenge-277/avery-adams/README b/challenge-277/avery-adams/README new file mode 100644 index 0000000000..6aaa1f9308 --- /dev/null +++ b/challenge-277/avery-adams/README @@ -0,0 +1 @@ +Solutions by Avery Adams. diff --git a/challenge-277/aviral-goel/README b/challenge-277/aviral-goel/README new file mode 100644 index 0000000000..e64ee14512 --- /dev/null +++ b/challenge-277/aviral-goel/README @@ -0,0 +1 @@ +Solutions by Aviral Goel. diff --git a/challenge-277/barroff/README b/challenge-277/barroff/README new file mode 100644 index 0000000000..03cd0cea2e --- /dev/null +++ b/challenge-277/barroff/README @@ -0,0 +1 @@ +Solution by BarrOff. diff --git a/challenge-277/baryshevs/README b/challenge-277/baryshevs/README new file mode 100644 index 0000000000..61199ce0e4 --- /dev/null +++ b/challenge-277/baryshevs/README @@ -0,0 +1 @@ +Solutions by Baryshev Sergey. diff --git a/challenge-277/bejoy-mathews/README b/challenge-277/bejoy-mathews/README new file mode 100644 index 0000000000..475b1c4fe5 --- /dev/null +++ b/challenge-277/bejoy-mathews/README @@ -0,0 +1 @@ +Solutions by Bejoy Abraham Mathews. diff --git a/challenge-277/belmark