The task of Day 6 is to count letters :-). Well, not that straightforward. There’s some input like this split into groups and lines: abc a b c ab ac We have to count how many times each letter enters in each group. Again, the original task is more storyline-type and you’d better read it … Continue reading “Advent of Code 2020 Day 6/25 in the Raku programming language”
Category: Programming languages
Advent of Code 2020 Day 5/25 in the Raku programming language
On Day 5, they gave a task to find a seat number in a place. We have a list of occupied seats in a special form. Long story short, the rows and the seats within the row are encoded binary, but instead of 0 and 1, letters are used: F and B for rows and … Continue reading “Advent of Code 2020 Day 5/25 in the Raku programming language”
Advent of Code 2020 Day 4/25 in the Raku programming language
In Day 4 of the Advent of Code, we are checking the fields of the passports. For each passport, there are a few fields labelled with a three-letter codes: byr (Birth Year) iyr (Issue Year) eyr (Expiration Year) hgt (Height) hcl (Hair Color) ecl (Eye Color) pid (Passport ID) cid (Country ID) The full record for a single passport contains colon-separated pairs key:value: … Continue reading “Advent of Code 2020 Day 4/25 in the Raku programming language”
Advent of Code 2020 Day 3/25 in the Raku programming language
In Day 3, we have to walk through the forest that is mapped in the following way: ..##……. #…#…#.. .#….#..#. ..#.#…#.# .#…##..#. ..#.##….. .#.#.#….# This pattern is repeated horizontally as many times as needed. In a single step, we can make three moves cells and one row down. It is also OK to pass through … Continue reading “Advent of Code 2020 Day 3/25 in the Raku programming language”
Advent of Code 2020 Day 2/25 in the Raku programming language
Here is my Raku solution to the problem of Day 2 of this year’s Advent of Code. The problem is to check if the passwords satisfy the requirement which is mentioned before the password: The phrase 1-3 a means that the character a must appear one to three times in the password, not fewer nor … Continue reading “Advent of Code 2020 Day 2/25 in the Raku programming language”
Advent of Code 2020 Day 1/25 in the Raku programming language
OK, I solved a few days of the on-going this year’s Advent of Code, so maybe it is a good idea to document it a bit so that those who like Raku can look at it too. So, the problem of Day 1 is to take a long list of integers and find such two … Continue reading “Advent of Code 2020 Day 1/25 in the Raku programming language”
A problem solved in 22 programming languages
In this post I am demonstrating the solutions of a programming problem in 22 different languages: Raku, Python, C++, Perl, Ruby, Scala, C#, Dart, Julia, D, Lisp, C, JavaScript (Node.js), Java, Rust, Pascal, Go, Lua, Fortran, PHP, Kotlin, and Bash.
In this post I am demonstrating the solutions of a programming problem in 22 different languages: Raku, Python, C++, Perl, Ruby, Scala, C#, Dart, Julia, D, Lisp, C, JavaScript (Node.js), Java, Rust, Pascal, Go, Lua, Fortran, PHP, Kotlin, and Bash.
Raku Challenge, Week 85
Welcome back to another week of the Weekly Challenge, and today I’ll briefly describe my solutions to the Week 85. Task 1. Triplet Sum. Task 2. Power of Two Integers.
Welcome back to another week of the Weekly Challenge, and today I’ll briefly describe my solutions to the Week 85. Task 1. Triplet Sum. Task 2. Power of Two Integers.
The Pearls of Raku, Issue 13: functional elements and recursive sum
In this issue, we’ll take a look at an interesting pattern of passing multiple arguments to a function and apply it to creating a recursive sum.
In this issue, we’ll take a look at an interesting pattern of passing multiple arguments to a function and apply it to creating a recursive sum.
The Pearls of Raku, Issue 12: all and any
In this issue we’ll briefly talk about practical cases where junctions are really handy — both in syntax and in making the program simpler. Examples of using all and any junctions, checking parameters of MAIN, using in subsets.
In this issue we’ll briefly talk about practical cases where junctions are really handy — both in syntax and in making the program simpler. Examples of using all and any junctions, checking parameters of MAIN, using in subsets.
The Pearls of Raku, Issue 11: wrapping things
In this issue, we’ll talk about the built-in wrap routine and its possible applications: wrapping a function, measuring execution time, and logging.
In this issue, we’ll talk about the built-in wrap routine and its possible applications: wrapping a function, measuring execution time, and logging.
The Pearls of Raku, Issue 10: the -rw things
In this issue, we’ll discuss three elements in the Raku programming language that have the -rw suffix: substr-rw, return-rw, and take-rw.
In this issue, we’ll discuss three elements in the Raku programming language that have the -rw suffix: substr-rw, return-rw, and take-rw.
Raku Challenge Week 4, Task 1: Printing π
Let me return to the old challenges from last year and fill a few more gaps. The task for now is to write a program to output the same number of π digits as the size of the program.
Let me return to the old challenges from last year and fill a few more gaps. The task for now is to write a program to output the same number of π digits as the size of the program.
The weekly challenge 078: Leader element and Left rotation
This week, The Weekly Challenge offered us a couple of simple tasks, so why not solve it on Monday. Task1: Leader Element. Task 2: Left Rotation.
This week, The Weekly Challenge offered us a couple of simple tasks, so why not solve it on Monday. Task1: Leader Element. Task 2: Left Rotation.
Programming with passion
This week, I wrote a few programs solving the task of this week’s Weekly Challenge. I already explained the solution in the Raku programming language. In this post, I’d like to demonstrate other solutions. The key point is that they not only use different programming language but also approach the problem differently and implement different algorithms.
This week, I wrote a few programs solving the task of this week’s Weekly Challenge. I already explained the solution in the Raku programming language. In this post, I’d like to demonstrate other solutions. The key point is that they not only use different programming language but also approach the problem differently and implement different algorithms.
Lonely X — The Weekly Challenge 77, Task 2
The second task of this week’s challenge sounds like this:
You are given m x n character matrix consists of O and X only. Write a script to count the total number of X surrounded by O only. Print 0 if none found.
The second task of this week’s challenge sounds like this:
You are given m x n character matrix consists of O and X only. Write a script to count the total number of X surrounded by O only. Print 0 if none found.
Add up Fibonacci numbers — The Weekly Challenge 77, Task 1
The task today is: You are given a positive integer $N. Write a script to find out all possible combination of Fibonacci Numbers required to get $N on addition. You are NOT allowed to repeat a number. Print 0 if none found.
The task today is: You are given a positive integer $N. Write a script to find out all possible combination of Fibonacci Numbers required to get $N on addition. You are NOT allowed to repeat a number. Print 0 if none found.
A more idiomatic Raku solution
A couple of days ago I published a straightforward solution to the Task 2 of Week 75 of The Weekly Challenge. Despite that solution perfectly works, I wasn’t satisfied with it and wanted a more Raku-ish code. Here is the next iteration of it. my @hist = 3, 2, 3, 5, 7, 5; my $max … Continue reading “A more idiomatic Raku solution”
Largest Rectangle Histogram: The Raku Challenge Week 75, task 2
Hello, here is my solution to the Task 2 of Week 75 of the Weekly Challenge solved in the Raku programming language.
You are given an array of positive numbers @A. Write a script to find the largest rectangle histogram created by the given array.
Hello, here is my solution to the Task 2 of Week 75 of the Weekly Challenge solved in the Raku programming language.
You are given an array of positive numbers @A. Write a script to find the largest rectangle histogram created by the given array.
Coins Sum: The Raku Challenge Week 75, task 1
Here is my solution to the Task 1 of the Week 75 of the Weekly Challenge solved in the Raku programming language.
You are given a set of coins @C, assuming you have infinite amount of each coin in the set. Write a script to find how many ways you make sum $S using the coins from the set @C.
Here is my solution to the Task 1 of the Week 75 of the Weekly Challenge solved in the Raku programming language.
You are given a set of coins @C, assuming you have infinite amount of each coin in the set. Write a script to find how many ways you make sum $S using the coins from the set @C.