Skip to content

Commit

Permalink
Add q38
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkun committed Aug 5, 2024
1 parent bbc7a7f commit 0e0ba02
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ex/q038.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
;; https://4clojure.oxal.org/#/problem/038

(ns ex.q038)

(defn ans
"Problem 38, Maximum value. (restriction: max,max-key)"
[& args]
(reduce #(if (> %1 %2) %1 %2) args))
11 changes: 11 additions & 0 deletions test/ex/q038_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
;; https://4clojure.oxal.org/#/problem/038

(ns ex.q038-test
(:require [clojure.test :as t]
[ex.q038 :as sut]))

(t/deftest test-q38
(t/testing "Problem 38, Maximum value"
(t/is (= 8 (sut/ans 1 8 3 4)))
(t/is (= 30 (sut/ans 30 20)))
(t/is (= 67 (sut/ans 45 67 11)))))

0 comments on commit 0e0ba02

Please sign in to comment.