From e1775c1d9e4d74de0a21e4e971a0eb701f21c8a5 Mon Sep 17 00:00:00 2001 From: Lubos Kolouch Date: Sat, 11 Mar 2023 14:01:51 +0100 Subject: Blog 207 --- challenge-005/lubos-kolouch/perl/ch-1.pl | 40 +++++++ challenge-005/lubos-kolouch/perl/ch-2.pl | 57 ++++++++++ challenge-005/lubos-kolouch/python/ch-1.py | 43 ++++++++ challenge-005/lubos-kolouch/python/ch-2.py | 81 ++++++++++++++ challenge-006/lubos-kolouch/perl/ch-1.pl | 72 ++++++++++++ challenge-006/lubos-kolouch/python/ch-1.py | 50 +++++++++ .../lubos-kolouch/20230311_Weekly_challenge_207.md | 121 +++++++++++++++++++++ 7 files changed, 464 insertions(+) create mode 100644 challenge-005/lubos-kolouch/perl/ch-1.pl create mode 100644 challenge-005/lubos-kolouch/perl/ch-2.pl create mode 100644 challenge-005/lubos-kolouch/python/ch-1.py create mode 100644 challenge-005/lubos-kolouch/python/ch-2.py create mode 100644 challenge-006/lubos-kolouch/perl/ch-1.pl create mode 100644 challenge-006/lubos-kolouch/python/ch-1.py create mode 100644 challenge-207/lubos-kolouch/20230311_Weekly_challenge_207.md diff --git a/challenge-005/lubos-kolouch/perl/ch-1.pl b/challenge-005/lubos-kolouch/perl/ch-1.pl new file mode 100644 index 0000000000..01c8817f8c --- /dev/null +++ b/challenge-005/lubos-kolouch/perl/ch-1.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +sub print_anagrams { + my $word = shift; + my %freq; + + # Count the frequency of each letter in the word + $freq{$_}++ for split //, $word; + + # Recursively generate all anagrams + sub generate_anagrams { + my ( $prefix, $freq_ref ) = @_; + + # Base case: no more letters left to add + if ( length $prefix == length $word ) { + print "$prefix\n"; + return; + } + + # Recursive case: add one more letter to the prefix + for my $letter ( keys %$freq_ref ) { + if ( $freq_ref->{$letter} > 0 ) { + $freq_ref->{$letter}--; + generate_anagrams( $prefix . $letter, $freq_ref ); + $freq_ref->{$letter}++; + } + } + } + + # Start generating anagrams with an empty prefix and the frequency hash + generate_anagrams( "", \%freq ); +} + +# Test the function with some example words +print_anagrams("hello"); +print_anagrams("pear"); +print_anagrams("racecar"); diff --git a/challenge-005/lubos-kolouch/perl/ch-2.pl b/challenge-005/lubos-kolouch/perl/ch-2.pl new file mode 100644 index 0000000000..918be4654e --- /dev/null +++ b/challenge-005/lubos-kolouch/perl/ch-2.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +# This program finds the sequence of characters that has the most anagrams. + +=head1 SYNOPSIS + +This program finds the sequence of characters that has the most anagrams. + +=cut + +# Function to find the sequence of characters that has the most anagrams +sub find_most_anagrams { + my ($str) = @_; + + # Create a hash to store all the anagrams + my %anagrams; + + # Iterate over each substring of the given string + for my $substring ( substrings($str) ) { + + # Sort the characters of the substring + my $sorted_substring = join '', sort split //, $substring; + + # Add the substring to the anagrams hash + push @{ $anagrams{$sorted_substring} }, $substring; + } + + # Find the sequence with the most anagrams + my $max_anagrams = 0; + my $max_sequence = ""; + for my $sequence ( keys %anagrams ) { + my $count = scalar @{ $anagrams{$sequence} }; + if ( $count > $max_anagrams ) { + $max_anagrams = $count; + $max_sequence = $sequence; + } + } + + return $max_sequence; +} + +# Function to generate all substrings of a given string +sub substrings { + my ($str) = @_; + + my @substrings; + for my $i ( 0 .. length($str) - 1 ) { + for my $j ( $i .. length($str) ) { + push @substrings, substr( $str, $i, $j - $i ); + } + } + + return @substrings; +} diff --git a/challenge-005/lubos-kolouch/python/ch-1.py b/challenge-005/lubos-kolouch/python/ch-1.py new file mode 100644 index 0000000000..131d7f5333 --- /dev/null +++ b/challenge-005/lubos-kolouch/python/ch-1.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +This program prints all anagrams of a given word. + +Input: +word - a string representing the word to find anagrams of + +Output: +A list of all anagrams of the given word + +""" + +import itertools + + +def get_anagrams(word: str) -> set: + """ + This function takes a word and finds all anagrams of it + + Input: + word - a string representing the word to find anagrams of + + Output: + A list of all anagrams of the given word + + """ + + # generate all permutations of the given word + permutations = itertools.permutations(word) + + # convert the permutations to strings + anagrams = ["".join(p) for p in permutations] + + # remove duplicates + anagrams = list(set(anagrams)) + + return set(anagrams) + + +# tests +assert get_anagrams("cat") == {"tca", "tac", "act", "atc", "cta", "cat"} diff --git a/challenge-005/lubos-kolouch/python/ch-2.py b/challenge-005/lubos-kolouch/python/ch-2.py new file mode 100644 index 0000000000..c5d59cd975 --- /dev/null +++ b/challenge-005/lubos-kolouch/python/ch-2.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +This program finds the sequence of characters that has the most anagrams. + +Input: +A string of any length + +Output: +The sequence of characters that has the most anagrams + +""" + +import itertools + + +def find_anagrams(string): + """ + This function takes a string and returns a list of all its anagrams. + + Parameters: + string (str): The string to be used + + Returns: + anagrams (list): A list of all the anagrams of the input string + """ + + all_permutations = list(itertools.permutations(string)) + anagrams = [] + + for permutation in all_permutations: + anagram = "".join(permutation) + anagrams.append(anagram) + + return anagrams + + +def most_anagrams(string): + """ + This function takes a string and returns the sequence of characters that has the most anagrams. + + Parameters: + string (str): The string to be used + + Returns: + most_anagrams (str): The sequence of characters that has the most anagrams + """ + + all_anagrams = [] + + for i in range(1, len(string) + 1): + all_anagrams.append(find_anagrams(string[:i])) + + max_length = 0 + most_anagrams = "" + + for anagrams in all_anagrams: + if len(anagrams) > max_length: + max_length = len(anagrams) + most_anagrams = anagrams[0] + + return most_anagrams + + +# Tests + + +def test_find_anagrams(): + assert find_anagrams("cat") == ["cat", "cta", "act", "atc", "tca", "tac"] + + +def test_most_anagrams(): + assert most_anagrams("cat") == "ca" + + +if __name__ == "__main__": + string = input("Please enter a string: ") + print( + f"The sequence of characters that has the most anagrams is: {most_anagrams(string)}" + ) diff --git a/challenge-006/lubos-kolouch/perl/ch-1.pl b/challenge-006/lubos-kolouch/perl/ch-1.pl new file mode 100644 index 0000000000..03722cf548 --- /dev/null +++ b/challenge-006/lubos-kolouch/perl/ch-1.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +=head1 DESCRIPTION + +This script takes a list of numbers from command line and print the same in the compact form. + +For example, if you pass “1,2,3,4,9,10,14,15,16” then it should print the compact form like “1-4,9,10,14-16”. + +=cut + +# Get the list of numbers from command line +my @numbers = @ARGV; + +# Sort the list of numbers in ascending order +@numbers = sort { $a <=> $b } @numbers; + +# Initializing variables +my @compact_list; +my $first_num = $numbers[0]; +my $last_num = $numbers[0]; + +# Generate the compact list +foreach my $num (@numbers) { + if ( $num == $last_num + 1 ) { + + # If the current number is 1 more than the last number, + # update the last number + $last_num = $num; + } + else { + # If the current number is not 1 more than the last number, + # add the range of numbers to the compact list + if ( $first_num == $last_num ) { + push @compact_list, $first_num; + } + else { + push @compact_list, "$first_num-$last_num"; + } + + # Reset the variables + $first_num = $num; + $last_num = $num; + } +} + +# Add the last range of numbers to the compact list +if ( $first_num == $last_num ) { + push @compact_list, $first_num; +} +else { + push @compact_list, "$first_num-$last_num"; +} + +# Print the compact list +print join( ',', @compact_list ); + +=head1 TESTING + +=over 4 + +=item * + +Input: 1,2,3,4,9,10,14,15,16 + +Expected Output: 1-4,9,10,14-16 + +=back + +=cut diff --git a/challenge-006/lubos-kolouch/python/ch-1.py b/challenge-006/lubos-kolouch/python/ch-1.py new file mode 100644 index 0000000000..24f6e3d0e0 --- /dev/null +++ b/challenge-006/lubos-kolouch/python/ch-1.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +This script takes a list of numbers from command line and prints them in the compact form. + +Example: + Input: 1,2,3,4,9,10,14,15,16 + Output: 1-4,9,10,14-16 +""" + +import sys + + +def CompactList(numbers): + """This function takes a list of numbers as input and returns the list in compact form. + + Args: + numbers (list): A list of numbers + + Returns: + str: The list in compact form + + Examples: + >>> CompactList([1,2,3,4,9,10,14,15,16]) + '1-4,9,10,14-16' + """ + compact_list = [] + start = numbers[0] + end = numbers[0] + for i in range(1, len(numbers)): + if numbers[i] - numbers[i - 1] == 1: + end = numbers[i] + else: + if start == end: + compact_list.append(str(start)) + else: + compact_list.append(str(start) + "-" + str(end)) + start = numbers[i] + end = numbers[i] + if start == end: + compact_list.append(str(start)) + else: + compact_list.append(str(start) + "-" + str(end)) + return ",".join(compact_list) + + +if __name__ == "__main__": + numbers = [int(i) for i in sys.argv[1].split(",")] + print(CompactList(numbers)) diff --git a/challenge-207/lubos-kolouch/20230311_Weekly_challenge_207.md b/challenge-207/lubos-kolouch/20230311_Weekly_challenge_207.md new file mode 100644 index 0000000000..cf5b28321d --- /dev/null +++ b/challenge-207/lubos-kolouch/20230311_Weekly_challenge_207.md @@ -0,0 +1,121 @@ +# THE WEEKLY CHALLENGE - 207 + +### + +https://theweeklychallenge.org/blog/perl-weekly-challenge-207/ + +**March 11th, 2023** + +## Task 1 - How to Check if a Word is Typable with a Single Keyboard Row + +We all know the feeling of typing out a long word and suddenly realizing that you had to switch keyboard rows to do it. Well, now there's a way to check if a word can be typed using only one row of a standard QWERTY keyboard! + +This Perl code snippet uses a hash map to store the keyboard layout, then checks it against a given word to see if it can be typed using only one row: + +```perl +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More; + +my @keyboard_rows = qw(qwertyuiop asdfghjkl zxcvbnm); +my %keyboard_map; + +# Create a hash map to store the keyboard layout +for my $i ( 0 .. 2 ) { + my $row = $keyboard_rows[$i]; + $keyboard_map{$_} = $i + 1 for split( '', $row ); +} + +# Function to check if a word can be typed using only one row of the keyboard +sub is_single_row_word { + my ($word) = @_; + my $row = $keyboard_map{ lc( substr( $word, 0, 1 ) ) }; + for my $c ( split( '', lc($word) ) ) { + return 0 if $keyboard_map{$c} != $row; + } + return 1; +} + +# Test example 1 +my @words1 = ( "Hello", "Alaska", "Dad", "Peace" ); +my @single_row_words1 = grep { is_single_row_word($_) } @words1; +is_deeply( \@single_row_words1, [ "Alaska", "Dad" ], "Example 1" ); + +# Test example 2 +my @words2 = ( "OMG", "Bye" ); +my @single_row_words2 = grep { is_single_row_word($_) } @words2; +is_deeply( \@single_row_words2, [], "Example 2" ); + +done_testing(); +``` + +This code uses the `grep` function to filter a list of words and return the ones that can be typed using only one row of the keyboard. For example, the list `"Hello", "Alaska", "Dad", "Peace"` would return `"Alaska", "Dad"` as these are the only two words that can be typed with a single row. + +Now you can be sure that you're not typing words that require two different keyboard rows! + +## Task 2 - Unlocking the Mysteries of the H-Index with Perl + +Have you ever wanted to know your H-Index? It's not a mystery anymore! With the help of Perl, you can figure out your own H-Index in no time. + +An H-Index is the largest number h such that h articles have at least h citations each. This is used to measure the impact of a researcher's work. + +Here is how to calculate your H-Index using Perl. + +First, you need to use strict and warnings in your code. + +```perl +use strict; +use warnings; +``` + +Then, you should use feature 'say' to make your code more readable. + +```perl +use feature 'say'; +``` + +Next, you will need to include the Test::More module. This will allow you to run tests on your code. + +```perl +use Test::More; +``` + +Now, you can create a subroutine to calculate your H-Index. + +```perl +sub h_index { + my @citations = @_; + my $n = scalar @citations; + my $h = 0; + my @sorted_citations = sort { $b <=> $a } @citations; + + for ( my $i = 0 ; $i < $n ; $i++ ) { + if ( $sorted_citations[$i] >= $i + 1 ) { + $h = $i + 1; + } + else { + last; + } + } + return $h; +} +``` + +Finally, you can run tests on your code to make sure it is working correctly. + +```perl +# Run the tests +my @citations_1 = ( 10, 8, 5, 4, 3 ); +my $h_index_1 = h_index(@citations_1); +is( $h_index_1, 4, "Test Example 1" ); + +my @citations_2 = ( 25, 8, 5, 3, 3 ); +my $h_index_2 = h_index(@citations_2); +is( $h_index_2, 3, "Test Example 2" ); + +done_testing(); +``` + +And there you have it! You can now calculate your own H-Index using Perl. -- cgit From 2a9c7f49feef90d54aa477b5a80c2979a548cb81 Mon Sep 17 00:00:00 2001 From: deadmarshal Date: Sat, 11 Mar 2023 17:03:30 +0330 Subject: TWC207 --- challenge-207/deadmarshal/cpp/ch-1.cpp | 33 +++++++++++++ challenge-207/deadmarshal/cpp/ch-2.cpp | 22 +++++++++ challenge-207/deadmarshal/d/ch1.d | 28 +++++++++++ challenge-207/deadmarshal/d/ch2.d | 20 ++++++++ challenge-207/deadmarshal/modula-3/ch1/src/Ch1.m3 | 47 +++++++++++++++++++ .../deadmarshal/modula-3/ch1/src/m3makefile | 4 ++ challenge-207/deadmarshal/modula-3/ch2/src/Ch2.m3 | 20 ++++++++ .../deadmarshal/modula-3/ch2/src/m3makefile | 4 ++ challenge-207/deadmarshal/nim/ch1.nim | 18 ++++++++ challenge-207/deadmarshal/nim/ch2.nim | 7 +++ challenge-207/deadmarshal/oberon/Ch1.Mod | 54 ++++++++++++++++++++++ challenge-207/deadmarshal/oberon/Ch2.Mod | 28 +++++++++++ challenge-207/deadmarshal/pascal/ch1.pas | 46 ++++++++++++++++++ challenge-207/deadmarshal/pascal/ch2.pas | 20 ++++++++ challenge-207/deadmarshal/perl/ch-1.pl | 25 ++++++++++ challenge-207/deadmarshal/perl/ch-2.pl | 12 +++++ challenge-207/deadmarshal/raku/ch-1.raku | 23 +++++++++ challenge-207/deadmarshal/raku/ch-2.raku | 12 +++++ 18 files changed, 423 insertions(+) create mode 100644 challenge-207/deadmarshal/cpp/ch-1.cpp create mode 100644 challenge-207/deadmarshal/cpp/ch-2.cpp create mode 100644 challenge-207/deadmarshal/d/ch1.d create mode 100644 challenge-207/deadmarshal/d/ch2.d create mode 100644 challenge-207/deadmarshal/modula-3/ch1/src/Ch1.m3 create mode 100644 challenge-207/deadmarshal/modula-3/ch1/src/m3makefile create mode 100644 challenge-207/deadmarshal/modula-3/ch2/src/Ch2.m3 create mode 100644 challenge-207/deadmarshal/modula-3/ch2/src/m3makefile create mode 100644 challenge-207/deadmarshal/nim/ch1.nim create mode 100644 challenge-207/deadmarshal/nim/ch2.nim create mode 100644 challenge-207/deadmarshal/oberon/Ch1.Mod create mode 100644 challenge-207/deadmarshal/oberon/Ch2.Mod create mode 100644 challenge-207/deadmarshal/pascal/ch1.pas create mode 100644 challenge-207/deadmarshal/pascal/ch2.pas create mode 100644 challenge-207/deadmarshal/perl/ch-1.pl create mode 100644 challenge-207/deadmarshal/perl/ch-2.pl create mode 100644 challenge-207/deadmarshal/raku/ch-1.raku create mode 100644 challenge-207/deadmarshal/raku/ch-2.raku diff --git a/challenge-207/deadmarshal/cpp/ch-1.cpp b/challenge-207/deadmarshal/cpp/ch-1.cpp new file mode 100644 index 0000000000..e778f5824b --- /dev/null +++ b/challenge-207/deadmarshal/cpp/ch-1.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include + +bool all_match(const std::string &s1, const std::string &s2) +{ + for(auto &c : s1) if(s2.find(c) == std::string::npos) return false; + return true; +} + +void keyboard_word(std::vector &vec) +{ + const std::vector + qwerty{"qwertyuiop","asdfghjkl","zxcvbnm"}; + for(auto &s : vec) + std::transform(s.begin(),s.end(),s.begin(), + [](unsigned char c){return std::tolower(c);}); + for(const auto &q : qwerty) + for(const auto &s : vec) + if(all_match(s,q)) std::cout << s << ' '; + std::cout << '\n'; +} + +int main() +{ + std::vector vec1{"Hello","Alaska","Dad","Peace"}, + vec2{"OMG","Bye"}; + keyboard_word(vec1); + keyboard_word(vec2); + return 0; +} + diff --git a/challenge-207/deadmarshal/cpp/ch-2.cpp b/challenge-207/deadmarshal/cpp/ch-2.cpp new file mode 100644 index 0000000000..6af3160443 --- /dev/null +++ b/challenge-207/deadmarshal/cpp/ch-2.cpp @@ -0,0 +1,22 @@ +#include +#include + +int h_index(const std::vector &vec) +{ + int ret{}; + for(int i = 0; i < vec.size(); ++i) + if(i >= vec[i]) + { + ret = i; + break; + } + return ret; +} + +int main() +{ + std::cout << h_index({10,8,5,4,3}) << '\n'; + std::cout << h_index({25,8,5,3,3}) << '\n'; + return 0; +} + diff --git a/challenge-207/deadmarshal/d/ch1.d b/challenge-207/deadmarshal/d/ch1.d new file mode 100644 index 0000000000..af05e1ba16 --- /dev/null +++ b/challenge-207/deadmarshal/d/ch1.d @@ -0,0 +1,28 @@ +import std.stdio:writeln,write; +import std.uni:toLower; +import std.algorithm:map,all,canFind; +import std.array:array; + +bool all_match(ref string s1, ref string s2) +{ + foreach(ref c;s1) if(!canFind(s2,c)) return false; + return true; +} + +void keyboard_word(ref string[] words) +{ + string[] qwerty = ["qwertyuiop","asdfghjkl","zxcvbnm"]; + words = words.map!(toLower).array; + foreach(ref q;qwerty) + foreach(ref w;words) if(all_match(w,q)) write(w,' '); + writeln; +} + +void main() +{ + string[] words1 = ["Hello","Alaska","Dad","Peace"]; + string[] words2 = ["OMG","Bye"]; + keyboard_word(words1); + keyboard_word(words2); +} + diff --git a/challenge-207/deadmarshal/d/ch2.d b/challenge-207/deadmarshal/d/ch2.d new file mode 100644 index 0000000000..3dc2974bad --- /dev/null +++ b/challenge-207/deadmarshal/d/ch2.d @@ -0,0 +1,20 @@ +import std.stdio:writeln; + +int h_index(int[] arr) +{ + int ret = 0; + for(int i = 0; i < arr.length; ++i) + if(i >= arr[i]) + { + ret = i; + break; + } + return ret; +} + +void main() +{ + writeln(h_index([10,8,5,4,3])); + writeln(h_index([25,8,5,3,3])); +} + diff --git a/challenge-207/deadmarshal/modula-3/ch1/src/Ch1.m3 b/challenge-207/deadmarshal/modula-3/ch1/src/Ch1.m3 new file mode 100644 index 0000000000..04ba90c5ef --- /dev/null +++ b/challenge-207/deadmarshal/modula-3/ch1/src/Ch1.m3 @@ -0,0 +1,47 @@ +MODULE Ch1 EXPORTS Main; + +IMPORT IO,Text,ASCII; + +VAR + A1:ARRAY[0..3] OF TEXT := ARRAY OF TEXT{"Hello","Alaska","Dad","Peace"}; + A2:ARRAY[0..1] OF TEXT := ARRAY OF TEXT{"OMG","Bye"}; + +PROCEDURE Lower(text:TEXT):TEXT = + VAR + Res:TEXT := ""; + BEGIN + FOR I := 0 TO Text.Length(text)-1 DO + Res := Text.Cat(Res, Text.FromChar(ASCII.Lower[Text.GetChar(text, I)])); + END; + RETURN Res; + END Lower; + +PROCEDURE AllMatch(VAR text:TEXT;VAR S:SET OF CHAR):BOOLEAN = + BEGIN + FOR I := 0 TO Text.Length(text)-1 DO + IF NOT Text.GetChar(text,I) IN S THEN RETURN FALSE END + END; + RETURN TRUE; + END AllMatch; + +PROCEDURE KeyboardWord(VAR A:ARRAY OF TEXT) = +VAR + S1:SET OF CHAR := SET OF CHAR{'q','w','e','r','t','y','u','i','o','p'}; + S2:SET OF CHAR := SET OF CHAR{'a','s','d','f','g','h','j','k','l'}; + S3:SET OF CHAR := SET OF CHAR{'z','x','c','v','b','n','m'}; +BEGIN + FOR I := FIRST(A) TO LAST(A) DO A[I] := Lower(A[I]) END; + FOR I := FIRST(A) TO LAST(A) DO + IF AllMatch(A[I],S1) OR AllMatch(A[I],S2) OR AllMatch(A[I],S3) THEN + IO.Put(A[I]); + IO.PutChar(' ') + END + END; + IO.Put("\n"); +END KeyboardWord; + +BEGIN + KeyboardWord(A1); + KeyboardWord(A2); +END Ch1. + diff --git a/challenge-207/deadmarshal/modula-3/ch1/src/m3makefile b/challenge-207/deadmarshal/modula-3/ch1/src/m3makefile new file mode 100644 index 0000000000..0ee72d695b --- /dev/null +++ b/challenge-207/deadmarshal/modula-3/ch1/src/m3makefile @@ -0,0 +1,4 @@ +import("libm3") +implementation("Ch1") +program("ch1") + diff --git a/challenge-207/deadmarshal/modula-3/ch2/src/Ch2.m3 b/challenge-207/deadmarshal/modula-3/ch2/src/Ch2.m3 new file mode 100644 index 0000000000..62f84618e9 --- /dev/null +++ b/challenge-207/deadmarshal/modula-3/ch2/src/Ch2.m3 @@ -0,0 +1,20 @@ +MODULE Ch2 EXPORTS Main; + +IMPORT IO; + +VAR + A1:ARRAY[0..4] OF INTEGER := ARRAY OF INTEGER{10,8,5,4,3}; + A2:ARRAY[0..4] OF INTEGER := ARRAY OF INTEGER{25,8,5,3,3}; + +PROCEDURE HIndex(VAR A:ARRAY OF INTEGER):INTEGER = + BEGIN + FOR I := FIRST(A) TO LAST(A) DO + IF I >= A[I] THEN RETURN I END + END; + END HIndex; + +BEGIN + IO.PutInt(HIndex(A1)); IO.Put("\n"); + IO.PutInt(HIndex(A2)); IO.Put("\n"); +END Ch2. + diff --git a/challenge-207/deadmarshal/modula-3/ch2/src/m3makefile b/challenge-207/deadmarshal/modula-3/ch2/src/m3makefile new file mode 100644 index 0000000000..5c32bbc4bb --- /dev/null +++ b/challenge-207/deadmarshal/modula-3/ch2/src/m3makefile @@ -0,0 +1,4 @@ +import("libm3") +implementation("Ch2") +program("ch2") + diff --git a/challenge-207/deadmarshal/nim/ch1.nim b/challenge-207/deadmarshal/nim/ch1.nim new file mode 100644 index 0000000000..6ba9eaf314 --- /dev/null +++ b/challenge-207/deadmarshal/nim/ch1.nim @@ -0,0 +1,18 @@ +import std/[strutils] + +proc keyboardWord(strseq:var seq[string]):seq[string] = + var + s1:set[char] = {'q','w','e','r','t','y','u','i','o','p'} + s2:set[char] = {'a','s','d','f','g','h','j','k','l'} + s3:set[char] = {'z','x','c','v','b','n','m'} + for s in strseq.mitems: s = toLowerAscii(s) + for myset in [s1,s2,s3]: + for s in strseq: + if allCharsInSet(s,myset): result.add(s) +var + s1:seq[string] = @["Hello","Alaska","Dad","Peace"] + s2:seq[string] = @["OMG","Bye"] + +echo keyboardWord(s1) +echo keyboardWord(s2) + diff --git a/challenge-207/deadmarshal/nim/ch2.nim b/challenge-207/deadmarshal/nim/ch2.nim new file mode 100644 index 0000000000..b570160249 --- /dev/null +++ b/challenge-207/deadmarshal/nim/ch2.nim @@ -0,0 +1,7 @@ +proc hIndex(s:seq[int]):int = + for i in 0..= s[i]: return i + +echo hIndex(@[10,8,5,4,3]) +echo hIndex(@[25,8,5,3,3]) + diff --git a/challenge-207/deadmarshal/oberon/Ch1.Mod b/challenge-207/deadmarshal/oberon/Ch1.Mod new file mode 100644 index 0000000000..1928ee8074 --- /dev/null +++ b/challenge-207/deadmarshal/oberon/Ch1.Mod @@ -0,0 +1,54 @@ +MODULE Ch1; + + IMPORT Out,Strings,ethStrings; + + TYPE + PArr = POINTER TO ARRAY OF ARRAY OF CHAR; + + VAR + A1,A2:PArr; + + PROCEDURE Init; + BEGIN + NEW(A1,4,7); NEW(A2,2,4); + COPY("Hello",A1[0]); COPY("Alaska",A1[1]); COPY("Dad",A1[2]); + COPY("Peace",A1[3]); + COPY("OMG",A2[0]); COPY("Bye",A2[1]); + END Init; + + PROCEDURE AllMatch(Haystack,Needle:ARRAY OF CHAR):BOOLEAN; + VAR + i:LONGINT; + s:ARRAY 2 OF CHAR; + BEGIN + s[1] := 0X; + FOR i := 0 TO Strings.Length(Needle) DO + s[0] := Needle[i]; + IF Strings.Pos(s,Haystack,0) = -1 THEN RETURN FALSE END + END; + RETURN TRUE + END AllMatch; + + PROCEDURE KeyboardWord(VAR A:PArr); + VAR + i,j:LONGINT; + qwerty:ARRAY 3,10 OF CHAR; + BEGIN + COPY("qwertyuiop",qwerty[0]); + COPY("asdfghjkl",qwerty[1]); + COPY("zxcvbnm",qwerty[2]); + FOR i := 0 TO LEN(A^)-1 DO ethStrings.Lower(A[i],A[i]) END; + FOR i := 0 TO LEN(qwerty)-1 DO + FOR j := 0 TO LEN(A^)-1 DO + IF AllMatch(qwerty[i],A[j]) THEN Out.String(A[j]); Out.Char(' ') END + END + END; + Out.Ln + END KeyboardWord; + +BEGIN + Init; + KeyboardWord(A1); + KeyboardWord(A2); +END Ch1. + diff --git a/challenge-207/deadmarshal/oberon/Ch2.Mod b/challenge-207/deadmarshal/oberon/Ch2.Mod new file mode 100644 index 0000000000..91ac5e1200 --- /dev/null +++ b/challenge-207/deadmarshal/oberon/Ch2.Mod @@ -0,0 +1,28 @@ +MODULE Ch2; + + IMPORT Out; + + VAR + A1,A2:ARRAY 5 OF INTEGER; + + PROCEDURE Init; + BEGIN + A1[0] := 10; A1[1] := 8; A1[2] := 5; A1[3] := 4; A1[4] := 3; + A2[0] := 25; A2[1] := 8; A2[2] := 5; A2[3] := 3; A2[4] := 3; + END Init; + + PROCEDURE HIndex(VAR A:ARRAY OF INTEGER):INTEGER; + VAR + i:LONGINT; + BEGIN + FOR i := 0 TO LEN(A)-1 DO + IF i >= A[i] THEN RETURN SHORT(i) END + END; + END HIndex; + +BEGIN + Init; + Out.Int(HIndex(A1),0); Out.Ln; + Out.Int(HIndex(A2),0); Out.Ln; +END Ch2. + diff --git a/challenge-207/deadmarshal/pascal/ch1.pas b/challenge-207/deadmarshal/pascal/ch1.pas new file mode 100644 index 0000000000..843d231a23 --- /dev/null +++ b/challenge-207/deadmarshal/pascal/ch1.pas @@ -0,0 +1,46 @@ +program Ch1; + +{$mode objfpc} + +uses + SysUtils,StrUtils,Types,GVector; + +type + TVec = specialize TVector; + +var + I:Integer; + A1:TStringDynArray = ('Hello','Alaska','Dad','Peace'); + A2:TStringDynArray = ('ONG','Bye'); + Res1,Res2:TVec; + +function AllMatch(Needle,Haystack:AnsiString):Boolean; +var + I:Integer; +begin + for I := Low(Needle) to High(Needle) do + if FindPart(Needle[I],Haystack) = 0 then Exit(False); + Exit(True); +end; + +function KeyboardWord(var Arr:TStringDynArray):TVec; +var + I,J:Integer; + Qwerty:TStringDynArray = ('qwertyuiop','asdfghjkl','zxcvbnm'); +begin + Result := TVec.Create; + for I := Low(Arr) to High(Arr) do Arr[I] := LowerCase(Arr[I]); + for I := Low(Qwerty) to High(Qwerty) do + for J := Low(Arr) to High(Arr) do + if AllMatch(Arr[J],Qwerty[I]) then Result.PushBack(Arr[J]); +end; + +begin + Res1 := KeyboardWord(A1); + Res2 := KeyboardWord(A2); + for I := 0 to Pred(Res1.Size) do Write(Res1[I],' '); WriteLn; + for I := 0 to Pred(Res2.Size) do Write(Res2[I],' '); WriteLn; + FreeAndNil(Res1); + FreeAndNil(Res2); +end. + diff --git a/challenge-207/deadmarshal/pascal/ch2.pas b/challenge-207/deadmarshal/pascal/ch2.pas new file mode 100644 index 0000000000..8f54f5ea5a --- /dev/null +++ b/challenge-207/deadmarshal/pascal/ch2.pas @@ -0,0 +1,20 @@ +program Ch2; + +{$mode objfpc} + +uses + SysUtils,Types; + +function HIndex(A:TIntegerDynArray):Integer; +var + I:Integer; +begin + for I := Low(A) to High(A) do + if(I >= A[I]) then Exit(I); +end; + +begin + WriteLn(HIndex([10,8,5,4,3])); + WriteLn(HIndex([25,8,5,3,3])); +end. + diff --git a/challenge-207/deadmarshal/perl/ch-1.pl b/challenge-207/deadmarshal/perl/ch-1.pl new file mode 100644 index 0000000000..d0ee6bae07 --- /dev/null +++ b/challenge-207/deadmarshal/perl/ch-1.pl @@ -0,0 +1,25 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use List::Util qw(all); +use Set::Scalar; + +sub keyboard_word{ + my ($arr) = @_; + my ($s1,$s2,$s3) = (Set::Scalar->new(split '',"qwertyuiop"), + Set::Scalar->new(split '',"asdfghjkl"), + Set::Scalar->new(split '',"zxcvbnm")); + my @ret; + @$arr = map {lc} @$arr; + foreach my $str(@$arr){ + foreach my $set($s1,$s2,$s3){ + if(all {$set->has($_)} split '',$str){push @ret,$str} + } + } + @ret; +} + +printf "(%s)\n", join ' ', + keyboard_word(["Hello","Alaska","Dad","Peace"]); +printf "(%s)\n", join ' ', keyboard_word(["OMG","Bye"]); + diff --git a/challenge-207/deadmarshal/perl/ch-2.pl b/challenge-207/deadmarshal/perl/ch-2.pl new file mode 100644 index 0000000000..5308581fb1 --- /dev/null +++ b/challenge-207/deadmarshal/perl/ch-2.pl @@ -0,0 +1,12 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +sub h_index{ + my ($arr) = @_; + map {return $_ if $_ >= $arr->[$_]} 0..$#$arr; +} + +printf "%d\n", h_index([10,8,5,4,3]); +printf "%d\n", h_index([25,8,5,3,3]); + diff --git a/challenge-207/deadmarshal/raku/ch-1.raku b/challenge-207/deadmarshal/raku/ch-1.raku new file mode 100644 index 0000000000..e0a42c599b --- /dev/null +++ b/challenge-207/deadmarshal/raku/ch-1.raku @@ -0,0 +1,23 @@ +#!/usr/bin/env raku + +sub keyboard-word(@arr) +{ + my $s1 = set ; + my $s2 = set ; + my $s3 = set ; + my @ret; + @arr = @arr.lc; + for @arr -> $str { + my @chars = $str.comb; + for ($s1,$s2,$s3) -> $set { + if (so $set{$_} == @chars.all) { + @ret.push: $str; + } + } + } + @ret; +} + +say keyboard-word(["Hello","Alaska","Dad","Peace"]); +say keyboard-word(["OMG","Bye"]); + diff --git a/challenge-207/deadmarshal/raku/ch-2.raku b/challenge-207/deadmarshal/raku/ch-2.raku new file mode 100644 index 0000000000..15b6e87410 --- /dev/null +++ b/challenge-207/deadmarshal/raku/ch-2.raku @@ -0,0 +1,12 @@ +#!/usr/bin/env raku + +sub h-index(@arr) +{ + for 0..@arr.end -> $i { + return $i if $i >= @arr[$i]; + } +} + +say h-index([10,8,5,4,3]); +say h-index([25,8,5,3,3]); + -- cgit From 1fa7cf32ff81cd4f85676693185763eccbafe73f Mon Sep 17 00:00:00 2001 From: Pip Date: Sat, 11 Mar 2023 13:05:03 -0600 Subject: Pip Stuart's submission for challenge-207. --- challenge-207/pip/perl/ch-1.pl | 40 ++++++++++++++++++++++++++++++++++++++++ challenge-207/pip/perl/ch-2.pl | 26 ++++++++++++++++++++++++++ challenge-207/pip/raku/ch-1.raku | 40 ++++++++++++++++++++++++++++++++++++++++ challenge-207/pip/raku/ch-2.raku | 26 ++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 challenge-207/pip/perl/ch-1.pl create mode 100644 challenge-207/pip/perl/ch-2.pl create mode 100644 challenge-207/pip/raku/ch-1.raku create mode 100644 challenge-207/pip/raku/ch-2.raku diff --git a/challenge-207/pip/perl/ch-1.pl b/challenge-207/pip/perl/ch-1.pl new file mode 100644 index 0000000000..2bc64d9bd0 --- /dev/null +++ b/challenge-207/pip/perl/ch-1.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl +# HTTPS://TheWeeklyChallenge.Org - Perl/Raku Weekly Challenge #207 - Pip Stuart +# Task1: Keyboard Word: Submitted by: Mohammad S Anwar; You are given an array of words. +# Write a script to print all the words in the given array that can be types using alphabet on only one row of the keyboard. +# Let us assume the keys are arranged as below: +# Row1: qwertyuiop +# Row2: asdfghjkl +# Row3: zxcvbnm +# Example1: +# In-put: @words = ("Hello","Alaska","Dad","Peace") +# Output: ( "Alaska","Dad" ) +# Example2: +# In-put: @words = ("OMG","Bye") +# Output: ( ) +use strict;use warnings;use utf8;use v5.12;my $d8VS='N38LGYRO'; +sub KbWd {my @wrdz = @_;my @rwdz = ();my @rowz = ({}, {}, {}); + for (split('', 'qwertyuiop')) { $rowz[0]{$_} = 1; } + for (split('', 'asdfghjkl' )) { $rowz[1]{$_} = 1; } + for (split('', 'zxcvbnm' )) { $rowz[2]{$_} = 1; } + for (@wrdz) {my @lcwd = split('', lc($_));my $airf = 0; + for my $rown (0..2) { + if ( exists($rowz[$rown]{$lcwd[0]})) { $airf = 1; + for my $letr (@lcwd) { # loop thru all of @LowerCasedWorD + if (!exists($rowz[$rown]{$letr })) { $airf = 0; last; } + } # clear AllInRowFlag if any letter is not in the same row + } + } + if ($airf) { push(@rwdz, $_); } + } + printf( "(\"%s\") => ", join('","', @wrdz)); + if (@rwdz) { printf("(\"%s\");\n" , join('","', @rwdz)); } + else { say "();"; } + return(@rwdz); +} +if (@ARGV) { + KbWd(@ARGV); +} else { + KbWd("Hello","Alaska","Dad","Peace"); # => ("Alaska","Dad"); + KbWd("OMG","Bye" ); # => (""); +} diff --git a/challenge-207/pip/perl/ch-2.pl b/challenge-207/pip/perl/ch-2.pl new file mode 100644 index 0000000000..1e2e37c947 --- /dev/null +++ b/challenge-207/pip/perl/ch-2.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl +# HTTPS://TheWeeklyChallenge.Org - Perl/Raku Weekly Challenge #207 - Pip Stuart +# Task2: H-Index: Submitted by: Mohammad S Anwar; You are given an array of integers containing citations a researcher has received for each paper. +# Write a script to compute the researcher’s H-Index. For more information please checkout the wikipedia page. +# The H-Index is the largest number h such that h articles have at least h citations each. For example, if an author has five publications, with 9, 7, 6, +# 2, and 1 citations (ordered from greatest to least), then the author’s h-index is 3, because the author has three publications with 3 or more citations. +# However, the author does not have four publications with 4 or more citations. +# Example1: +# In-put: @citations = (10,8,5,4,3) +# Output: 4 Because the 4th publication has 4 citations and the 5th has only 3. +# Example2: +# In-put: @citations = (25,8,5,3,3) +# Output: 3 The H-Index is 3 because the fourth paper has only 3 citations. +# Last date to submit the solution 23:59 (UK Time) Sunday 12th March 2023. +use strict;use warnings;use utf8;use v5.12;my $d8VS='N38LDAYS'; +sub HNdx {my @ctnz = sort { $b <=> $a } @_;my $hndx = 0; + while ($hndx < @ctnz && $ctnz[$hndx] > $hndx) { $hndx++; } + printf("(%-10s) => %d;\n", join(',', @ctnz), $hndx); + return($hndx); +} +if (@ARGV) { + HNdx(@ARGV); +} else { + HNdx(10,8,5,4,3); # => 4; + HNdx(25,8,5,3,3); # => 3; +} diff --git a/challenge-207/pip/raku/ch-1.raku b/challenge-207/pip/raku/ch-1.raku new file mode 100644 index 0000000000..6d9cb7a43f --- /dev/null +++ b/challenge-207/pip/raku/ch-1.raku @@ -0,0 +1,40 @@ +#!/usr/bin/env raku +# HTTPS://TheWeeklyChallenge.Org - Perl/Raku Weekly Challenge #207 - Pip Stuart +# Task1: Keyboard Word: Submitted by: Mohammad S Anwar; You are given an array of words. +# Write a script to print all the words in the given array that can be types using alphabet on only one row of the keyboard. +# Let us assume the keys are arranged as below: +# Row1: qwertyuiop +# Row2: asdfghjkl +# Row3: zxcvbnm +# Example1: +# In-put: @words = ("Hello","Alaska","Dad","Peace") +# Output: ( "Alaska","Dad" ) +# Example2: +# In-put: @words = ("OMG","Bye") +# Output: ( ) +use v6;my $d8VS='N39L7wLC'; +sub KbWd {my @wrdz = @_;my @rwdz = ();my @rowz = ({}, {}, {}); + for (split('', 'qwertyuiop', :skip-empty)) { @rowz[0]{$_} = 1; } + for (split('', 'asdfghjkl' , :skip-empty)) { @rowz[1]{$_} = 1; } + for (split('', 'zxcvbnm' , :skip-empty)) { @rowz[2]{$_} = 1; } + for (@wrdz) {my @lcwd = split('', lc($_), :skip-empty);my $airf = 0; + for 0..2 -> $rown { + if ( @rowz[$rown]{@lcwd[0]}:exists ) { $airf = 1; + for @lcwd -> $letr { # loop thru all of @LowerCasedWorD + if (!(@rowz[$rown]{$letr }:exists)) { $airf = 0; last; } + } # clear AllInRowFlag if any letter is not in the same row + } + } + if ($airf) { push(@rwdz, $_); } + } + printf( "(\"%s\") => ", join('","', @wrdz)); + if (@rwdz) { printf("(\"%s\");\n" , join('","', @rwdz)); } + else { say "();"; } + return(@rwdz); +} +if (@*ARGS) { + KbWd(@*ARGS); +} else { + KbWd("Hello","Alaska","Dad","Peace"); # => ("Alaska","Dad"); + KbWd("OMG","Bye" ); # => (""); +} diff --git a/challenge-207/pip/raku/ch-2.raku b/challenge-207/pip/raku/ch-2.raku new file mode 100644 index 0000000000..6dc1ab005a --- /dev/null +++ b/challenge-207/pip/raku/ch-2.raku @@ -0,0 +1,26 @@ +#!/usr/bin/env raku +# HTTPS://TheWeeklyChallenge.Org - Perl/Raku Weekly Challenge #207 - Pip Stuart +# Task2: H-Index: Submitted by: Mohammad S Anwar; You are given an array of integers containing citations a researcher has received for each paper. +# Write a script to compute the researcher’s H-Index. For more information please checkout the wikipedia page. +# The H-Index is the largest number h such that h articles have at least h citations each. For example, if an author has five publications, with 9, 7, 6, +# 2, and 1 citations (ordered from greatest to least), then the author’s h-index is 3, because the author has three publications with 3 or more citations. +# However, the author does not have four publications with 4 or more citations. +# Example1: +# In-put: @citations = (10,8,5,4,3) +# Output: 4 Because the 4th publication has 4 citations and the 5th has only 3. +# Example2: +# In-put: @citations = (25,8,5,3,3) +# Output: 3 The H-Index is 3 because the fourth paper has only 3 citations. +# Last date to submit the solution 23:59 (UK Time) Sunday 12th March 2023. +use v6;my $d8VS='N39L81pR'; +sub HNdx {my @ctnz = sort -*, @_;my $hndx = 0; + while ($hndx < @ctnz.elems && @ctnz[$hndx] > $hndx) { $hndx++; } + printf("(%-10s) => %d;\n", join(',', @ctnz), $hndx); + return($hndx); +} +if (@*ARGS) { + HNdx(@*ARGS); +} else { + HNdx(10,8,5,4,3); # => 4; + HNdx(25,8,5,3,3); # => 3; +} -- cgit From 0573e335601fa51a96647057aa8c44116e84c364 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo de Oliveira Date: Sat, 11 Mar 2023 20:38:18 -0300 Subject: solution to challenge 207 --- challenge-207/carlos-oliveira/raku/ch-1.raku | 22 ++++++++++++++++++++++ challenge-207/carlos-oliveira/raku/ch-2.raku | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 challenge-207/carlos-oliveira/raku/ch-1.raku create mode 100644 challenge-207/carlos-oliveira/raku/ch-2.raku diff --git a/challenge-207/carlos-oliveira/raku/ch-1.raku b/challenge-207/carlos-oliveira/raku/ch-1.raku new file mode 100644 index 0000000000..1632a777c2 --- /dev/null +++ b/challenge-207/carlos-oliveira/raku/ch-1.raku @@ -0,0 +1,22 @@ +use Test; + +sub extract-keyboard-words (@words where all($_) ~~ Str:D) { + my @keyboard-rows = ( + Set.new(), + Set.new(), + Set.new() + ); + + gather { + for @words -> $raw-word { + my $word = lc $raw-word; + for @keyboard-rows -> %keyboard-row { + take $raw-word and next if all(%keyboard-row{$word.comb('')}); + } + } + } +} + +is extract-keyboard-words(["Hello", "Alaska", "Dad", "Peace"]), ["Alaska", "Dad"]; +is extract-keyboard-words(["OMG", "Bye"]), []; +is extract-keyboard-words(["ABC"]), []; diff --git a/challenge-207/carlos-oliveira/raku/ch-2.raku b/challenge-207/carlos-oliveira/raku/ch-2.raku new file mode 100644 index 0000000000..a79b57c83c --- /dev/null +++ b/challenge-207/carlos-oliveira/raku/ch-2.raku @@ -0,0 +1,14 @@ +use Test; + +sub h-index (@citations where all($_) ~~ Int:D) { + my $h-index = 0; + my $some-invalid = @citations.sort.reverse.first: { $_ < ++$h-index }; + return $some-invalid ?? $h-index - 1 !! $h-index; +} + +is h-index([10, 8, 5, 4, 3]), 4; +is h-index([25, 8, 5, 3, 3]), 3; +is h-index([7, 7, 7]), 3; +is h-index([2, 1]), 1; +is h-index([1]), 1; +is h-index([]), 0; -- cgit From 33c228c577d6ca63cba6571081a8a43dec55471a Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sat, 11 Mar 2023 23:45:54 +0000 Subject: - Added solutions by Lubos Kolouch. - Added solutions by Ali Muradi. - Added solutions by Pip Stuart. - Added solutions by Paulo Custodio. --- stats/pwc-challenge-005.json | 229 ++-- stats/pwc-challenge-006.json | 401 +++---- stats/pwc-challenge-200.json | 305 ++--- stats/pwc-current.json | 468 ++++---- stats/pwc-language-breakdown-summary.json | 70 +- stats/pwc-language-breakdown.json | 1482 ++++++++++++------------ stats/pwc-leaders.json | 416 +++---- stats/pwc-summary-1-30.json | 118 +- stats/pwc-summary-121-150.json | 32 +- stats/pwc-summary-151-180.json | 94 +- stats/pwc-summary-181-210.json | 114 +- stats/pwc-summary-211-240.json | 50 +- stats/pwc-summary-241-270.json | 44 +- stats/pwc-summary-271-300.json | 70 +- stats/pwc-summary-31-60.json | 112 +- stats/pwc-summary-61-90.json | 44 +- stats/pwc-summary-91-120.json | 40 +- stats/pwc-summary.json | 1788 ++++++++++++++--------------- 18 files changed, 2980 insertions(+), 2897 deletions(-) diff --git a/stats/pwc-challenge-005.json b/stats/pwc-challenge-005.json index 289cab3397..afc7e76155 100644 --- a/stats/pwc-challenge-005.json +++ b/stats/pwc-challenge-005.json @@ -1,20 +1,35 @@ { + "xAxis" : { + "type" : "category" + }, + "tooltip" : { + "headerFormat" : "{series.name}
", + "followPointer" : 1, + "pointFormat" : "{point.name}: {point.y:f}
" + }, + "title" : { + "text" : "The Weekly Challenge - 005" + }, + "subtitle" : { + "text" : "[Champions: 30] Last updated at 2023-03-11 23:32:22 GMT" + }, "legend" : { "enabled" : 0 }, "series" : [ { - "name" : "Perl Weekly Challenge - 005", + "name" : "The Weekly Challenge - 005", + "colorByPoint" : 1, "data" : [ { "y" : 3, - "drilldown" : "Adam Russell", - "name" : "Adam Russell" + "name" : "Adam Russell", + "drilldown" : "Adam Russell" }, { - "y" : 2, "name" : "Andrezgz", - "drilldown" : "Andrezgz" + "drilldown" : "Andrezgz", + "y" : 2 }, { "y" : 3, @@ -22,9 +37,9 @@ "drilldown" : "Arne Sommer" }, { - "y" : 2, "drilldown" : "Athanasius", - "name" : "Athanasius" + "name" : "Athanasius", + "y" : 2 }, { "y" : 2, @@ -32,28 +47,28 @@ "name" : "Daniel Mantovani" }, { - "y" : 2, "name" : "Doug Schrag", - "drilldown" : "Doug Schrag" + "drilldown" : "Doug Schrag", + "y" : 2 }, { - "drilldown" : "Duncan C. White", + "y" : 2, "name" : "Duncan C. White", - "y" : 2 + "drilldown" : "Duncan C. White" }, { - "drilldown" : "E. Choroba", + "y" : 3, "name" : "E. Choroba", - "y" : 3 + "drilldown" : "E. Choroba" }, { - "y" : 3, + "name" : "Francis Whittle", "drilldown" : "Francis Whittle", - "name" : "Francis Whittle" + "y" : 3 }, { - "name" : "Guillermo Ramos", "drilldown" : "Guillermo Ramos", + "name" : "Guillermo Ramos", "y" : 1 }, { @@ -67,24 +82,24 @@ "y" : 2 }, { - "y" : 4, "drilldown" : "Jaldhar H. Vyas", - "name" : "Jaldhar H. Vyas" + "name" : "Jaldhar H. Vyas", + "y" : 4 }, { "y" : 2, - "drilldown" : "James Smith", - "name" : "James Smith" + "name" : "James Smith", + "drilldown" : "James Smith" }, { + "y" : 3, "name" : "Jo Christian Oterhals", - "drilldown" : "Jo Christian Oterhals", - "y" : 3 + "drilldown" : "Jo Christian Oterhals" }, { - "y" : 5, "drilldown" : "Joelle Maslak", - "name" : "Joelle Maslak" + "name" : "Joelle Maslak", + "y" : 5 }, { "y" : 2, @@ -92,54 +107,59 @@ "drilldown" : "John Barrett" }, { - "name" : "Kian-Meng Ang", + "y" : 3, "drilldown" : "Kian-Meng Ang", - "y" : 3 + "name" : "Kian-Meng Ang" }, { - "drilldown" : "Lakpa Tashi Bhutia", "name" : "Lakpa Tashi Bhutia", + "drilldown" : "Lakpa Tashi Bhutia", "y" : 2 }, { - "drilldown" : "Lars Balker", "name" : "Lars Balker", + "drilldown" : "Lars Balker", "y" : 2 }, { - "name" : "Laurent Rosenfeld", + "y" : 6, "drilldown" : "Laurent Rosenfeld", - "y" : 6 + "name" : "Laurent Rosenfeld" + }, + { + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch", + "y" : 2 }, { - "name" : "Mark Senn", + "y" : 3, "drilldown" : "Mark Senn", - "y" : 3 + "name" : "Mark Senn" }, { + "y" : 1, "name" : "Max Kossek", - "drilldown" : "Max Kossek", - "y" : 1 + "drilldown" : "Max Kossek" }, { - "y" : 2, + "name" : "Paulo Custodio", "drilldown" : "Paulo Custodio", - "name" : "Paulo Custodio" + "y" : 2 }, { - "y" : 2, "name" : "Robert Gratza", - "drilldown" : "Robert Gratza" + "drilldown" : "Robert Gratza", + "y" : 2 }, { "y" : 4, - "drilldown" : "Ruben Westerberg", - "name" : "Ruben Westerberg" + "name" : "Ruben Westerberg", + "drilldown" : "Ruben Westerberg" }, { + "y" : 4, "drilldown" : "Ryan Thompson", - "name" : "Ryan Thompson", - "y" : 4 + "name" : "Ryan Thompson" }, { "y" : 3, @@ -147,12 +167,11 @@ "name" : "Simon Proctor" }, { - "y" : 2, + "drilldown" : "Stuart Little", "name" : "Stuart Little", - "drilldown" : "Stuart Little" + "y" : 2 } - ], - "colorByPoint" : 1 + ] } ], "yAxis" : { @@ -160,21 +179,11 @@ "text" : "Total Solutions" } }, - "chart" : { - "type" : "column" - }, - "tooltip" : { - "pointFormat" : "{point.name}: {point.y:f}
", - "followPointer" : 1, - "headerFormat" : "{series.name}
" - }, - "subtitle" : { - "text" : "[Champions: 29] Last updated at 2021-04-17 16:19:51 GMT" - }, "drilldown" : { "series" : [ { "id" : "Adam Russell", + "name" : "Adam Russell", "data" : [ [ "Perl", @@ -184,18 +193,17 @@ "Blog", 1 ] - ], - "name" : "Adam Russell" + ] }, { - "name" : "Andrezgz", "id" : "Andrezgz", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Andrezgz" }, { "id" : "Arne Sommer", @@ -222,24 +230,24 @@ "name" : "Athanasius" }, { + "id" : "Daniel Mantovani", "data" : [ [ "Perl", 2 ] ], - "id" : "Daniel Mantovani", "name" : "Daniel Mantovani" }, { - "id" : "Doug Schrag", + "name" : "Doug Schrag", "data" : [ [ "Raku", 2 ] ], - "name" : "Doug Schrag" + "id" : "Doug Schrag" }, { "data" : [ @@ -248,10 +256,11 @@ 2 ] ], - "id" : "Duncan C. White", - "name" : "Duncan C. White" + "name" : "Duncan C. White", + "id" : "Duncan C. White" }, { + "id" : "E. Choroba", "name" : "E. Choroba", "data" : [ [ @@ -262,11 +271,10 @@ "Blog", 1 ] - ], - "id" : "E. Choroba" + ] }, { - "id" : "Francis Whittle", + "name" : "Francis Whittle", "data" : [ [ "Raku", @@ -277,20 +285,19 @@ 1 ] ], - "name" : "Francis Whittle" + "id" : "Francis Whittle" }, { "id" : "Guillermo Ramos", + "name" : "Guillermo Ramos", "data" : [ [ "Perl", 1 ] - ], - "name" : "Guillermo Ramos" + ] }, { - "id" : "Gustavo Chaves", "data" : [ [ "Perl", @@ -301,7 +308,8 @@ 1 ] ], - "name" : "Gustavo Chaves" + "name" : "Gustavo Chaves", + "id" : "Gustavo Chaves" }, { "name" : "Jaime Corchado", @@ -314,8 +322,8 @@ "id" : "Jaime Corchado" }, { - "name" : "Jaldhar H. Vyas", "id" : "Jaldhar H. Vyas", + "name" : "Jaldhar H. Vyas", "data" : [ [ "Perl", @@ -329,16 +337,15 @@ }, { "id" : "James Smith", + "name" : "James Smith", "data" : [ [ "Perl", 2 ] - ], - "name" : "James Smith" + ] }, { - "name" : "Jo Christian Oterhals", "data" : [ [ "Raku", @@ -349,6 +356,7 @@ 1 ] ], + "name" : "Jo Christian Oterhals", "id" : "Jo Christian Oterhals" }, { @@ -366,21 +374,20 @@ 1 ] ], - "id" : "Joelle Maslak", - "name" : "Joelle Maslak" + "name" : "Joelle Maslak", + "id" : "Joelle Maslak" }, { + "id" : "John Barrett", "name" : "John Barrett", "data" : [ [ "Perl", 2 ] - ], - "id" : "John Barrett" + ] }, { - "name" : "Kian-Meng Ang", "id" : "Kian-Meng Ang", "data" : [ [ @@ -391,29 +398,31 @@ "Blog", 1 ] - ] + ], + "name" : "Kian-Meng Ang" }, { + "id" : "Lakpa Tashi Bhutia", "data" : [ [ "Perl", 2 ] ], - "id" : "Lakpa Tashi Bhutia", "name" : "Lakpa Tashi Bhutia" }, { - "id" : "Lars Balker", "data" : [ [ "Perl", 2 ] ], - "name" : "Lars Balker" + "name" : "Lars Balker", + "id" : "Lars Balker" }, { + "id" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld", "data" : [ [ @@ -428,11 +437,20 @@ "Blog", 2 ] + ] + }, + { + "id" : "Lubos Kolouch", + "data" : [ + [ + "Perl", + 2 + ] ], - "id" : "Laurent Rosenfeld" + "name" : "Lubos Kolouch" }, { - "name" : "Mark Senn", + "id" : "Mark Senn", "data" : [ [ "Raku", @@ -443,17 +461,17 @@ 1 ] ], - "id" : "Mark Senn" + "name" : "Mark Senn" }, { "id" : "Max Kossek", + "name" : "Max Kossek", "data" : [ [ "Perl", 1 ] - ], - "name" : "Max Kossek" + ] }, { "id" : "Paulo Custodio", @@ -466,8 +484,8 @@ "name" : "Paulo Custodio" }, { - "name" : "Robert Gratza", "id" : "Robert Gratza", + "name" : "Robert Gratza", "data" : [ [ "Raku", @@ -476,7 +494,6 @@ ] }, { - "name" : "Ruben Westerberg", "id" : "Ruben Westerberg", "data" : [ [ @@ -487,11 +504,11 @@ "Raku", 2 ] - ] + ], + "name" : "Ruben Westerberg" }, { "name" : "Ryan Thompson", - "id" : "Ryan Thompson", "data" : [ [ "Perl", @@ -501,7 +518,8 @@ "Raku", 2 ] - ] + ], + "id" : "Ryan Thompson" }, { "name" : "Simon Proctor", @@ -518,30 +536,27 @@ "id" : "Simon Proctor" }, { + "id" : "Stuart Little", "data" : [ [ "Raku", 2 ] ], - "id" : "Stuart Little", "name" : "Stuart Little" } ] }, - "xAxis" : { - "type" : "category" - }, - "title" : { - "text" : "Perl Weekly Challenge - 005" + "chart" : { + "type" : "column" }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 + "format" : "{point.y}", + "enabled" : 1 + } } } } diff --git a/stats/pwc-challenge-006.json b/stats/pwc-challenge-006.json index d559c67e45..6cd5b9d538 100644 --- a/stats/pwc-challenge-006.json +++ b/stats/pwc-challenge-006.json @@ -1,29 +1,175 @@ { + "chart" : { + "type" : "column" + }, "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 } }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "xAxis" : { + "type" : "category" }, "tooltip" : { - "headerFormat" : "{series.name}
", "pointFormat" : "{point.name}: {point.y:f}
", + "headerFormat" : "{series.name}
", "followPointer" : 1 }, "title" : { - "text" : "Perl Weekly Challenge - 006" + "text" : "The Weekly Challenge - 006" + }, + "subtitle" : { + "text" : "[Champions: 25] Last updated at 2023-03-11 23:32:22 GMT" + }, + "legend" : { + "enabled" : 0 + }, + "series" : [ + { + "colorByPoint" : 1, + "data" : [ + { + "drilldown" : "Adam Russell", + "name" : "Adam Russell", + "y" : 3 + }, + { + "name" : "Alicia Bielsa", + "drilldown" : "Alicia Bielsa", + "y" : 1 + }, + { + "y" : 2, + "name" : "Andrezgz", + "drilldown" : "Andrezgz" + }, + { + "name" : "Arne Sommer", + "drilldown" : "Arne Sommer", + "y" : 3 + }, + { + "y" : 1, + "drilldown" : "Arpad Toth", + "name" : "Arpad Toth" + }, + { + "y" : 2, + "name" : "Athanasius", + "drilldown" : "Athanasius" + }, + { + "y" : 1, + "name" : "Daniel Mantovani", + "drilldown" : "Daniel Mantovani" + }, + { + "drilldown" : "Duncan C. White", + "name" : "Duncan C. White", + "y" : 2 + }, + { + "name" : "E. Choroba", + "drilldown" : "E. Choroba", + "y" : 3 + }, + { + "name" : "Guillermo Ramos", + "drilldown" : "Guillermo Ramos", + "y" : 1 + }, + { + "name" : "Gustavo Chaves", + "drilldown" : "Gustavo Chaves", + "y" : 2 + }, + { + "y" : 4, + "name" : "Jaldhar H. Vyas", + "drilldown" : "Jaldhar H. Vyas" + }, + { + "name" : "Joelle Maslak", + "drilldown" : "Joelle Maslak", + "y" : 4 + }, + { + "drilldown" : "Kian-Meng Ang", + "name" : "Kian-Meng Ang", + "y" : 2 + }, + { + "name" : "Lakpa Tashi Bhutia", + "drilldown" : "Lakpa Tashi Bhutia", + "y" : 2 + }, + { + "y" : 7, + "drilldown" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" + }, + { + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch", + "y" : 1 + }, + { + "drilldown" : "Maxim Kolodyazhny", + "name" : "Maxim Kolodyazhny", + "y" : 2 + }, + { + "drilldown" : "Ozzy", + "name" : "Ozzy", + "y" : 1 + }, + { + "y" : 2, + "name" : "Paulo Custodio", + "drilldown" : "Paulo Custodio" + }, + { + "name" : "Ruben Westerberg", + "drilldown" : "Ruben Westerberg", + "y" : 4 + }, + { + "y" : 4, + "name" : "Ryan Thompson", + "drilldown" : "Ryan Thompson" + }, + { + "drilldown" : "Simon Proctor", + "name" : "Simon Proctor", + "y" : 1 + }, + { + "y" : 2, + "drilldown" : "Stuart Little", + "name" : "Stuart Little" + }, + { + "y" : 2, + "name" : "Tim Smith", + "drilldown" : "Tim Smith" + } + ], + "name" : "The Weekly Challenge - 006" + } + ], + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "drilldown" : { "series" : [ { + "id" : "Adam Russell", "data" : [ [ "Perl", @@ -34,18 +180,17 @@ 1 ] ], - "id" : "Adam Russell", "name" : "Adam Russell" }, { "id" : "Alicia Bielsa", - "name" : "Alicia Bielsa", "data" : [ [ "Perl", 1 ] - ] + ], + "name" : "Alicia Bielsa" }, { "id" : "Andrezgz", @@ -58,6 +203,7 @@ ] }, { + "name" : "Arne Sommer", "data" : [ [ "Raku", @@ -68,50 +214,51 @@ 1 ] ], - "name" : "Arne Sommer", "id" : "Arne Sommer" }, { - "id" : "Arpad Toth", "name" : "Arpad Toth", "data" : [ [ "Perl", 1 ] - ] + ], + "id" : "Arpad Toth" }, { + "id" : "Athanasius", + "name" : "Athanasius", "data" : [ [ "Perl", 2 ] - ], - "name" : "Athanasius", - "id" : "Athanasius" + ] }, { - "name" : "Daniel Mantovani", "id" : "Daniel Mantovani", "data" : [ [ "Perl", 1 ] - ] + ], + "name" : "Daniel Mantovani" }, { - "id" : "Duncan C. White", "name" : "Duncan C. White", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Duncan C. White" }, { + "id" : "E. Choroba", + "name" : "E. Choroba", "data" : [ [ "Perl", @@ -121,28 +268,26 @@ "Blog", 1 ] - ], - "id" : "E. Choroba", - "name" : "E. Choroba" + ] }, { + "name" : "Guillermo Ramos", "data" : [ [ "Perl", 1 ] ], - "id" : "Guillermo Ramos", - "name" : "Guillermo Ramos" + "id" : "Guillermo Ramos" }, { + "name" : "Gustavo Chaves", "data" : [ [ "Perl", 2 ] ], - "name" : "Gustavo Chaves", "id" : "Gustavo Chaves" }, { @@ -160,6 +305,7 @@ "id" : "Jaldhar H. Vyas" }, { +