aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-348/conor-hoekstra/ch-1.bqn14
-rw-r--r--challenge-348/conor-hoekstra/ch-2.bqn15
2 files changed, 29 insertions, 0 deletions
diff --git a/challenge-348/conor-hoekstra/ch-1.bqn b/challenge-348/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..31bb491b31
--- /dev/null
+++ b/challenge-348/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,14 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/348-1.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+
+VowelCount ← +´∊⟜"AEIOUaeiou"
+StringAlike ← (2÷˜≠)⊸(↓((×⌊≡)○VowelCount)↑)
+
+# Tests
+u.UnitTest (StringAlike "textbook") ≡ 0
+u.UnitTest (StringAlike "book") ≡ 1
+u.UnitTest (StringAlike "AbCdEfGh") ≡ 1
+u.UnitTest (StringAlike "rhythmmyth") ≡ 0
+u.UnitTest (StringAlike "UmpireeAudio") ≡ 0
diff --git a/challenge-348/conor-hoekstra/ch-2.bqn b/challenge-348/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..1f0c9a3566
--- /dev/null
+++ b/challenge-348/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,15 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/348-2.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+
+Convert ← 2⊸↑ 60⊸×⊸+○•BQN 3⊸↓
+Count ← { a ← ⌊𝕩÷60 ⋄ b ← ⌊(𝕩-60×a)÷15 ⋄ c ← (𝕩-+´60‿15×a‿b)÷5 ⋄ +´a‿b‿c }
+ConvertTime ← Count·(1440⊸-⊸⌊)|∘-○Convert
+
+# Tests
+u.UnitTest ("02:30" ConvertTime "02:45") ≡ 1
+u.UnitTest ("11:55" ConvertTime "12:15") ≡ 2
+u.UnitTest ("09:00" ConvertTime "13:00") ≡ 4
+u.UnitTest ("23:45" ConvertTime "00:30") ≡ 3
+u.UnitTest ("14:20" ConvertTime "15:25") ≡ 2