Skip to content

Commit 7c7f56c

Browse files
committed
✨ kap examples
1 parent 4a7e307 commit 7c7f56c

File tree

9 files changed

+11
-1
lines changed

9 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Note that even when using `rlwrap`, some of the limitations will remain (such as
159159
| Language | 1a | 1b | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
160160
| :-------: | :-------------: | :-------------: | :-----------: | :-------------: | :-----------: | :-----------: | :-----------: | :-------------: | :-----------: | :-----------: |
161161
| APL | :green_heart: | :no_entry_sign: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: |
162+
| Kap | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: |
162163
| J | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: |
163164
| BQN | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: |
164165
| Uiua | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: | :green_heart: |

comparisons/leetcode/P0064_Max_Gap.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| | Solution | Link |
66
| :-------: | :-----------------------------------: | :---: |
77
| APL | `MaxGap ← {⌈/2-/(⊂⍤⍒⌷⊢)⍵}` | |
8+
| Kap | `MaxGap ⇐ ⌈/2-⍨/(⊂⍋)⍛⌷` | |
89
| J | `MaxGap =. {{ >./ 2-/\ \:~ y }}` | |
910
| BQN | `MaxGap ← {⌈´-´˘2↕∨𝕩}` | |
1011
| Uiua | `MaxGap ← /↥≡/-◫2⊏⍏.` | |

comparisons/leetcode/P0485_MCO.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ There are two general solutions covered here.
99
| | Solution | Link |
1010
| :-------: | :--------------------------------------------------------------------------: | :---------------------------------------------------------------------------: |
1111
| APL | `mco ← {0⌈⌈/(≢¨⊆⍨)⍵}` | [Link](https://github.com/codereport/LeetCode/blob/master/0015_Problem_1.apl) |
12+
| Kap | `Mco ⇐ ⌈/≢¨⊂⍨` |
1213
| J | `mco =. [: >./ [: (#;._1) 0,]` <br> `mco =. {{ >./ (#;._1) 0,y }}` | [Link](https://github.com/codereport/LeetCode/blob/master/0015_Problem_1.ijs) |
1314
| BQN | ``Mco ← ⌈´·+´¨(+`¬)⊸⊔ `` | [Link](https://github.com/codereport/LeetCode/blob/master/0015_Problem_1.bqn) |
1415
| Uiua | `Mco ← /↥⊜⧻.` | |
@@ -29,12 +30,13 @@ There are two general solutions covered here.
2930
| | Solution | Link |
3031
| :-------: | :--------------------------------------------------------------: | :---------------------------------------------------------------------------: |
3132
| APL | scan is broken | |
33+
| Kap | `mco ⇐ ⌈/⊢«×»+\` | |
3234
| J | `mco =. {{ >./(([*+)/\.)&.\|. y }}` | |
3335
| BQN | ``Mco ← ⌈´(⊢×+)` `` | [Link](https://github.com/codereport/LeetCode/blob/master/0015_Problem_1.bqn) |
3436
| Uiua | `Mco ← /↥\(×+,)` | |
3537
| Q | `mco: { max {y*y+x} scan x }` | |
3638
| Julia | `accumulate((a,b) -> b*(a+b), x) \|> maximum` | |
37-
| MATLAB | no scan |
39+
| MATLAB | no scan | |
3840
| NumPy | `np.max(np.frompyfunc(lambda a,b: b*(a+b), 2, 1).accumulate(x))` | |
3941
| R | `max(Reduce(function(a,b) b*(a+b), x, accumulate=TRUE))` | |
4042
| Nial | scan is broken | |

comparisons/leetcode/P0674_LCIS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| | Solution | Link |
66
| :-------: | :----------------------------------------------------: | :---------------------------------------------------------------------------: |
77
| APL | `lcis ← ⌈/≢¨((1,2≥/⊢)⊂⊢)`<br>`lcis ← {1⌈1+⌈/≢¨⊆⍨2</⍵}` | [Link](https://github.com/codereport/LeetCode/blob/master/0049_Problem_1.apl) |
8+
| Kap | `Lcis ⇐ 1+⌈/≢¨⊂⍨2</` | |
89
| J | `lcis =. {{ 1 + >./ (#;._1) 0,2</\ y }}` | [Link](https://github.com/codereport/LeetCode/blob/master/0049_Problem_1.ijs) |
910
| BQN | `LCIS ← {1+⌈´(⊢×+)``<´˘2↕𝕩}` | [Link](https://github.com/codereport/katas/blob/main/Top10/03_lcis.bqn) |
1011
| Uiua | `Lcis ← +1/↥\(×+,)≡/>◫2` | |

comparisons/leetcode/P1351_Count_Negatives.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| | Solution | Link |
88
| :-------: | :-----------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------: |
99
| APL | `+/0>,` | [Link](https://github.com/codereport/LeetCode/blob/master/0176_Problem_1.apl) |
10+
| Kap | `+/,0>` | |
1011
| J | `[:+/0>,` | [Link](https://github.com/codereport/LeetCode/blob/master/0176_Problem_1.ijs) |
1112
| BQN | `+´0>⥊` | |
1213
| Uiua | `/+<0♭` |

comparisons/leetcode/P1614_Max_Paren_Depth.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
| | Solution | Link |
99
| :-------: | :--------------------------------------------: | :---------------------------------------------------------------------------: |
1010
| APL | `maxDepth ← {⌈/+\-⌿'()'∘.=⍵}` | [Link](https://github.com/codereport/LeetCode/blob/master/0210_Problem_1.apl) |
11+
| Kap | `MaxDepth ⇐ ⌈/+\-⌿"()"∘.=` | |
1112
| J | `maxDepth =. {{ >./+/\-/'()'=/y }}` | |
1213
| BQN | ``MaxDepth ← ⌈´·+`·-˝"()"=⌜⊢`` | [Link](https://github.com/codereport/LeetCode/blob/master/0210_Problem_1.bqn) |
1314
| Q | `maxDepth: { max sums (-) over "()" =/:\: x }` | [Link](https://github.com/codereport/LeetCode/blob/master/0210_Problem_1.q) |

comparisons/leetcode/P1672_Richest_Customer_Wealth.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| | Solution | Link |
88
| :-------: | :-----------------------------: | :-------------------------------------------------------------------------------------------------------------------------: |
99
| APL | `⌈/+/` | [Link](https://github.com/codereport/LeetCode/blob/master/0217_Problem_1.apl) |
10+
| Kap | `⌈/+/` | |
1011
| J | `[: >./ +/"1` | [Link](https://github.com/codereport/LeetCode/blob/master/0217_Problem_1.ijs) |
1112
| BQN | `⌈´+˝⎉1` | [Link](https://github.com/codereport/LeetCode/blob/master/0217_Problem_1.bqn) |
1213
| Uiua | `/↥≡/+` | |

comparisons/leetcode/P1822_Sign_Product_Array.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| | Solution | Link |
88
| :-------: | :-------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: |
99
| APL | `×/×` | [Link](https://github.com/codereport/LeetCode/blob/master/0236_Problem_1.apl) |
10+
| Kap | `×/×` | |
1011
| J | `*/*` | |
1112
| BQN | `×´×` | |
1213
| Uiua | `/×±` | |

comparisons/leetcode/P2319_Check_Matrix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| | Solution | Link |
88
| :-------: | :---------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------: |
99
| APL | `checkMatrix ← {(1⌊⍵)≡(⊖⌈⊢)∘.=⍨⍳≢⍵}` | [Link](https://github.com/codereport/LeetCode/blob/master/0299_Problem_1.apl) |
10+
| Kap | `CheckMatrix ⇐ {(1⌊⍵)≡⌽⍛⌈(∘.=⍨)⍳≢⍵}` | |
1011
| J | `checkMatrix =. {{ (1<.y)-:(\|.>.])=/~i.#y }}` | [Link](https://github.com/codereport/LeetCode/blob/master/0299_Problem_1.ijs) |
1112
| BQN | `CheckMatrix ← {(1⌊𝕩)≡⌽⊸⌈=⌜˜↕≠𝕩}` | [Link](https://github.com/codereport/LeetCode/blob/master/0299_Problem_1.bqn) |
1213
| Uiua | `CheckMatrix ← ≅↧1∶↥⇌.⊞=.⇡⧻.` | |

0 commit comments

Comments
 (0)