We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 003bd10 commit 613fcb9Copy full SHA for 613fcb9
B0148_Problem_1.bqn
@@ -0,0 +1,16 @@
1
+# For up to date code:
2
+# https://github.com/codereport/bqn-code/blob/main/leetcode/b148-1.bqn
3
+
4
+# Link: https://leetcode.com/problems/maximum-difference-between-adjacent-elements-in-a-circular-array
5
6
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
7
+fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn"
8
9
+MaxAdjacentDistance ← ⌈´·|·fn.Deltas(1+≠)⊸⥊ # Tacit
10
+MaxAdjacentDistance2 ← { ⌈´|fn.Deltas𝕩⥊˜1+≠𝕩 } # Explicit
11
12
+# Tests
13
+u.UnitTest (MaxAdjacentDistance 1‿2‿4) ≡ 3
14
+u.UnitTest (MaxAdjacentDistance ¯5‿¯10‿¯5) ≡ 5
15
+u.UnitTest (MaxAdjacentDistance2 1‿2‿4) ≡ 3
16
+u.UnitTest (MaxAdjacentDistance2 ¯5‿¯10‿¯5) ≡ 5
0 commit comments