TABLE OF CONTENTS
1. HEADLINES
2. RECAP
3. PERL REVIEW
4. RAKU REVIEW
5. CHART
6. NEW MEMBERS
7. GUESTS
8. TASK #1: Count Set Bits
9. TASK #2: Trapped Rain Water
HEADLINES
Congratulations Team PWC for crossing the magic number once again.
This time we beat all previous record other than the launch week. So well done.
Here is the list of 10 weeks
when we crossed the magic number:
a) Week #001: 142
b) Week #002: 111
c) Week #030: 115
d) Week #033: 108
e) Week #048: 106
f) Week #072: 110
g) Week #073: 108
h) Week #074: 113
i) Week #075: 111
j) Week #078: 121
Let us welcome 3 new members, Kang-min Liu
, Vinod Kumar K
and Julio de Casto
in the Team PWC.
We also welcome back Dave Cross
after the break. It is always an honour to have your participation. It gives us extra energy and push.
Welcome back Abigail
and thanks for contributing solutions to Week #77 and Week #78.
This week, we had 36 contributions
by guests in 10 different languages. I would like to THANK
each and every guest contributors.
Lua
is the new language added to the list this week by Tyler Wardhaugh
.
a) Python: 8
b) Haskell: 6
c) C++: 4
d) Lisp: 4
e) APL: 2
f) Clojure: 2
g) JavaScript: 2
h) Lua: 2
i) Node: 2
j) Swift: 2
While we are talking about contributions, lets share some interesting stats from the GitHub repository.
1) Commits: 9551 (+206)
2) Pull Requests: 2330 (+58)
3) Contributors: 135 (+4)
4) Fork: 165 (+6)
5) Stars: 77 (+1)
Did you notice any changes to the website?
I have been making small changes to make the user interface more friendly.
You must have guessed it by now that I am not a designer. I am trying to the best of my capability.
There is one hurdle that I face every time I try to make any interface change is the lack of knowledge of Go Lang
.
I am using Hugo static site builder. In the past, Ryan Thompson
helped me with it.
Last but not the least, I would like to thank each and every member for their support and encouragement.
RECAP
Quick recap of the “The Weekly Challenge - 078” by Mohammad S Anwar
.
PERL REVIEW
Please checkout Perl solutions review of the “The Weekly Challenge - 077” by Colin Crain
.
If you missed any past reviews then please checkout the collection.
RAKU REVIEW
Please checkout Raku solutions review of the “The Weekly Challenge - 077” by Andrew Shitov
.
If you missed any past reviews then please checkout the collection.
CHART
Please take a look at the charts showing interesting data.
I would like to THANK
every member of the team for their valuable suggestions. Please do share your experience with us.
NEW MEMBERS
1) Kang-min Liu, an experienced Perl/Raku hacker from Fukuoka, Japan.
2) Vinod Kumar K, an experienced Perl hacker.
3) Julio de Castro, an experienced Perl/Raku hacker.
With the above additions, we now have 191
members in the Team PWC.
Please find out How to contribute?, if you have any doubts.
Please give it a try to an excellent tool EZPWC created by respected member Saif Ahmed
of Team PWC.
GUESTS
1) Abigail shared solutions to Task #1 and Task #2 in Node.
2) Andrew Shitov shared solutions to Task #1 and Task #2 in C++.
3) Andrew Shitov shared solutions to Task #1 and Task #2 in Python.
4) Aviral Goel shared solutions to Task #1 and Task #2 in Haskell.
5) Cheok-Yin Fung shared solutions to Task #1 and Task #2 in Lisp.
6) Lubos Kolouch shared solutions to Task #1 and Task #2 in Python.
7) Mohammad S Anwar shared solutions to Task #1 and Task #2 in Swift.
8) Myoungjin Jeon shared solutions to Task #1 and Task #2 in Haskell.
9) Myoungjin Jeon shared solutions to Task #1 and Task #2 in Lisp.
10) Nuno Vieira shared solutions to Task #1 and Task #2 in JavaScript.
11) Richard Park shared solutions to Task #1 and Task #2 in APL.
12) Roger Bell_West shared solutions to Task #1 and Task #2 in Python.
14) Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Clojure.
15) Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Lua.
16) Ulrich Rieke shared solutions to Task #1 and Task #2 in C++.
17) Ulrich Rieke shared solutions to Task #1 and Task #2 in Haskell.
18) Walt Mankowski shared solutions to Task #1 and Task #2 in Python.
Please find out past solutions by respected guests. Please do share your creative solutions in other languages.
TASK #1 › Count Set Bits
Submitted by: Mohammad S Anwar
You are given a positive number $N
.
Write a script to count the total numbrer of set bits of the binary representations of all numbers from 1
to $N
and return $total_count_set_bit % 1000000007
.
Example 1:
Input: $N = 4
Explanation: First find out the set bit counts of all numbers i.e. 1, 2, 3 and 4.
Decimal: 1
Binary: 001
Set Bit Counts: 1
Decimal: 2
Binary: 010
Set Bit Counts: 1
Decimal: 3
Binary: 011
Set Bit Counts: 2
Decimal: 4
Binary: 100
Set Bit Counts: 1
Total set bit count: 1 + 1 + 2 + 1 = 5
Output: Your script should print `5` as `5 % 1000000007 = 5`.
Example 2:
Input: $N = 3
Explanation: First find out the set bit counts of all numbers i.e. 1, 2 and 3.
Decimal: 1
Binary: 01
Set Bit Count: 1
Decimal: 2
Binary: 10
Set Bit Count: 1
Decimal: 3
Binary: 11
Set Bit Count: 2
Total set bit count: 1 + 1 + 2 = 4
Output: Your script should print `4` as `4 % 1000000007 = 4`.
TASK #2 › Trapped Rain Water
Submitted by: Mohammad S Anwar
You are given an array of positive numbers @N
.
Write a script to represent it as Histogram Chart and find out how much water it can trap.
Example 1:
Input: @N = (2, 1, 4, 1, 2, 5)
The histogram representation of the given array is as below.
5 #
4 # #
3 # #
2 # # # #
1 # # # # # #
_ _ _ _ _ _ _
2 1 4 1 2 5
Looking at the above histogram, we can see, it can trap 1 unit
of rain water between 1st and 3rd column. Similary it can trap 5 units
of rain water betweem 3rd and last column.
Therefore your script should print 6
.
Example 2:
Input: @N = (3, 1, 3, 1, 1, 5)
The histogram representation of the given array is as below.
5 #
4 #
3 # # #
2 # # #
1 # # # # # #
_ _ _ _ _ _ _
3 1 3 1 1 5
Looking at the above histogram, we can see, it can trap 2 units
of rain water between 1st and 3rd column. Also it can trap 4 units
of rain water between 3rd and last column.
Therefore your script should print 6
.
Last date to submit the solution 23:59 (UK Time) Sunday 27th September 2020.