Posts by rak1507
Challenge Given an array of numbers return the cumulative count of each item. This is the number of times an item has occurred so far. Examples [1,1,2,2,2,1,1,1,3,3] -> [1,2,1,2,3,3,4,5,1,2]...
Challenge Given two strings a and b, return the shortest string s so that s starts with a and ends with b. (Inspired by https://chat.stackexchange.com/transcript/message/57816868#57816868 ) Exam...
Challenge Given an array consisting of positive integers and 0s, return it with 0s acting like backspaces. Leading backspaces do nothing, and more backspaces than elements also does nothing. Cre...
Description APL trains are a series of functions, that get applied to an argument in this way: (f g) x = f g x (f g h) x = (f x) g (h x) (a b c d e f) x = (a (b c (d e f))) x = a (b x) c (d x) ...
Credit This challenge is taken with permission from https://www.mysterytwisterc3.org/en/challenges/level-1/beaver-code Description The encryption method is as follows: The plaintext is divided ...
Jelly, 7 bytes *Ḃ×½ḞµƬ *Ḃ×½ḞµƬ *Ḃ input ^ (input % 2) ×½ multiply sqrt(input) Ḟ floor µƬ iterate until converged and collect results Try it online!
Note: This challenge was underspecified and bad, and as such I would not encourage answering it in the future. Challenge You will be given a single 2D boolean array $M$. You may take its dimensi...
Definition $F_{n}\left(0\right)=0$ $F_{n}\left(1\right)=1$ $F_{n}\left(x\right)=n\cdot F_{n}\left(x-1\right)+F_{n}\left(x-2\right)$ For example: $F_{1}=\left[0,1,1,2,3,5,8,13,21,34,55,89...\ri...
Solutions by ngn https://chat.stackexchange.com/transcript/message/57690032#57690032 APL 17: {⍵[⍋⍋⍉⊖2⊥⍣¯1⍳≢⍵]} ngn/k 13: {x@<<+|2\!#x} These are too good not to post.
APL (Dyalog Classic), 47 bytes i←+∘1⋄d←-∘1⋄s←×⍨⋄o←⎕∘←⋄{}{0⌈a×256≠a←⍎⍕⍺,⍵}/⌽0,⍞ Try it online!