diff options
| -rw-r--r-- | challenge-320/conor-hoekstra/ch-1.bqn | 15 | ||||
| -rw-r--r-- | challenge-320/conor-hoekstra/ch-2.bqn | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/challenge-320/conor-hoekstra/ch-1.bqn b/challenge-320/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..332ee5a755 --- /dev/null +++ b/challenge-320/conor-hoekstra/ch-1.bqn @@ -0,0 +1,15 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/320-1.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" + +MaximumCount ← 0⊸<⌈○(+´)0⊸> +MaximumCount2 ← 0⊸(<⌈○(+´)>) + +# Tests +u.UnitTest (MaximumCount (¯3‿¯2‿¯1‿1‿2‿3)) ≡ 3 +u.UnitTest (MaximumCount (¯2‿¯1‿0‿0‿1)) ≡ 2 +u.UnitTest (MaximumCount (1‿2‿3‿4)) ≡ 4 +u.UnitTest (MaximumCount2 (¯3‿¯2‿¯1‿1‿2‿3)) ≡ 3 +u.UnitTest (MaximumCount2 (¯2‿¯1‿0‿0‿1)) ≡ 2 +u.UnitTest (MaximumCount2 (1‿2‿3‿4)) ≡ 4 diff --git a/challenge-320/conor-hoekstra/ch-2.bqn b/challenge-320/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..20d234a4ba --- /dev/null +++ b/challenge-320/conor-hoekstra/ch-2.bqn @@ -0,0 +1,12 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/320-2.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" +b ⇐ •Import "/home/cph/bqn-code/lib/binary.bqn" + +SumDifference ← |(+´·∾b.Digits¨)-+´ + +# Tests +u.UnitTest (SumDifference (1‿23‿4‿5)) ≡ 18 +u.UnitTest (SumDifference (1‿2‿3‿4‿5)) ≡ 0 +u.UnitTest (SumDifference (1‿2‿34)) ≡ 27 |
