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 0402806 commit 9cdd10eCopy full SHA for 9cdd10e
0426_Problem_2.bqn
@@ -0,0 +1,17 @@
1
+# For up to date code:
2
+# https://github.com/codereport/bqn-code/blob/main/leetcode/426-2.bqn
3
+
4
+# Link: https://leetcode.com/problems/smallest-number-with-all-set-bits
5
6
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
7
+fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn"
8
9
+GetLargestOutlier ← {
10
+ pairs ← ⍷⌽¨⊸∾(∾⋈fn._Tri↕≠𝕩)⊏¨<𝕩
11
+ ⌈´(+´𝕩)⊸((⊑∘⊢=-⟜(+´))×⊢´∘⊢)¨pairs
12
+}
13
14
+# Tests
15
+u.UnitTest (GetLargestOutlier 2‿3‿5‿10) ≡ 10
16
+u.UnitTest (GetLargestOutlier ¯2‿¯1‿¯3‿¯6‿4) ≡ 4
17
+u.UnitTest (GetLargestOutlier 1‿1‿1‿1‿1‿5‿5) ≡ 5
0 commit comments