aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-090/lubos-kolouch/perl/ch_1.pl56
-rw-r--r--challenge-090/lubos-kolouch/perl/ch_2.pl41
2 files changed, 97 insertions, 0 deletions
diff --git a/challenge-090/lubos-kolouch/perl/ch_1.pl b/challenge-090/lubos-kolouch/perl/ch_1.pl
new file mode 100644
index 0000000000..c2f0db0550
--- /dev/null
+++ b/challenge-090/lubos-kolouch/perl/ch_1.pl
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#===============================================================================
+#
+# FILE: ch_1.pl
+#
+# USAGE: ./ch_1.pl
+#
+# DESCRIPTION: Perl Weekly Challenge #090
+# Task 1
+# DNA Sequence
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: YOUR NAME (),
+# ORGANIZATION:
+# VERSION: 1.0
+# CREATED: 12/13/2020 02:07:44 PM
+# REVISION: ---
+#===============================================================================
+
+use strict;
+use warnings;
+
+
+sub process_sequence {
+ my $seq = shift;
+
+ my %counter;
+
+ my %compl = (
+ 'T' => 'A',
+ 'A' => 'T',
+ 'G' => 'C',
+ 'C' => 'G',
+ );
+
+ my $comp_seq = '';
+
+
+ for my $item (split //, $seq) {
+ $counter{$item}++;
+ $comp_seq .= $compl{$item};
+ }
+
+
+ print "$comp_seq\n";
+ return $comp_seq;
+}
+
+use Test::More;
+
+is(process_sequence('GTAAACCCCTTTTCATTTAGACAGATCGACTCCTTATCCATTCTCAGAGATGTGTTGCTGGTCGCCG'), 'CATTTGGGGAAAAGTAAATCTGTCTAGCTGAGGAATAGGTAAGAGTCTCTACACAACGACCAGCGGC');
+
+done_testing;
diff --git a/challenge-090/lubos-kolouch/perl/ch_2.pl b/challenge-090/lubos-kolouch/perl/ch_2.pl
new file mode 100644
index 0000000000..8670ed1229
--- /dev/null
+++ b/challenge-090/lubos-kolouch/perl/ch_2.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+#===============================================================================
+#
+# FILE: ch_2.pl
+#
+# USAGE: ./ch_2.pl
+#
+# DESCRIPTION: Perl Weekly Challenge #090
+# Task 2
+# Ethiopian Multiplication
+#
+# AUTHOR: Lubos Kolouch
+# CREATED: 12/13/2020 02:07:44 PM
+#===============================================================================
+
+use strict;
+use warnings;
+
+
+sub multiply {
+ my $input = shift;
+
+ my $first = $input->{first};
+ my $second = $input->{second};
+
+ my $result = 0;
+
+ while ($first > 1) {
+ $first = int($first / 2);
+ $second *= 2;
+
+ $result += $second;
+ }
+
+ return $result;
+}
+use Test::More;
+
+is(multiply({first => 14, second => 12}), 168);
+
+done_testing;