Skip to content

Commit 43b808a

Browse files
committed
✨ lc b146-1
1 parent 334175f commit 43b808a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

0429_Problem_1.bqn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
# Link: https://leetcode.com/problems/minimum-number-of-operations-to-make-elements-in-array-distinct
55

6+
u•Import "/home/cph/bqn-test/test.bqn"
7+
68
MinimumOperations+´·(⍷≠≠⊢)¨(0=3|↕)/¯1↓↓
79

810
# Tests

B0146_Problem_1.bqn

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# For up to date code:
2+
# https://github.com/codereport/bqn-code/blob/main/leetcode/b146-1.bqn
3+
4+
# Link: https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition
5+
6+
u•Import "/home/cph/bqn-test/test.bqn"
7+
8+
CountSubarrays+´·{𝕊abc:b=2×a+c}˘3↕⊢
9+
CountSubarrays2+´·(⊑=2×·+´1↓⊢)˘1˘3↕⊢
10+
11+
# Tests
12+
u.UnitTest (CountSubarrays1,2,1,4,1⟩) 1
13+
u.UnitTest (CountSubarrays1,1,1⟩) 0
14+
u.UnitTest (CountSubarrays21,2,1,4,1⟩) 1
15+
u.UnitTest (CountSubarrays21,1,1⟩) 0

0 commit comments

Comments
 (0)