aboutsummaryrefslogtreecommitdiff
path: root/challenge-262/barroff/julia
diff options
context:
space:
mode:
authorBarrOff <58253563+BarrOff@users.noreply.github.com>2024-03-31 22:35:00 +0200
committerBarrOff <58253563+BarrOff@users.noreply.github.com>2024-03-31 22:35:00 +0200
commit6e567d8a87f3947190a7444990bc91e5debcc87a (patch)
treea2846e6ec60bc5054e2ef7ff7efcb69a8ab02ae1 /challenge-262/barroff/julia
parentfdeee3349654c610d6ed2f4aca69ef8985e3c094 (diff)
downloadperlweeklychallenge-club-6e567d8a87f3947190a7444990bc91e5debcc87a.tar.gz
perlweeklychallenge-club-6e567d8a87f3947190a7444990bc91e5debcc87a.tar.bz2
perlweeklychallenge-club-6e567d8a87f3947190a7444990bc91e5debcc87a.zip
feat: add solutions for challenge 262 from BarrOff
Diffstat (limited to 'challenge-262/barroff/julia')
-rw-r--r--challenge-262/barroff/julia/ch-1.jl13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-262/barroff/julia/ch-1.jl b/challenge-262/barroff/julia/ch-1.jl
new file mode 100644
index 0000000000..210889d1de
--- /dev/null
+++ b/challenge-262/barroff/julia/ch-1.jl
@@ -0,0 +1,13 @@
+#!/usr/bin/env julia
+
+using Test: @test, @testset
+
+function max_positive_negative(ints::Vector{T})::Int where {T<:Integer}
+ maximum([count(x -> x > 0, ints), count(x -> x < 0, ints)])
+end
+
+@testset "count even digits number" begin
+ @test max_positive_negative([-3, 1, 2, -1, 3, -2, 4]) == 4
+ @test max_positive_negative([-1, -2, -3, 1]) == 3
+ @test max_positive_negative([1, 2]) == 2
+end