Activity for hyper-neutrino
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: Efficient censorship [Python 3], 102 bytes def f(x,y): 	a=[x] 	for x in a: 		if y not in x:return x 		for i in range(len(x)+1):a+=[x[:i]+x[i+1:]] Try it online! Not exactly the most efficient, but it works. Just a BFS of all possible removals. (more) |
— | 10 months ago |
Answer | — |
A: Repeat the characters [Jelly], 1 byte x Try It Online! `x` is Jelly's replicate atom. Since Jelly is inspired by languages like J, APL, etc, it is no surprise that is has an atom for a fairly important function. (more) |
— | over 2 years ago |
Answer | — |
A: Reduce over the range [1..n] [Python 2], 33 bytes lambda a,b:reduce(a,range(1,1+b)) Try it online! Or, without using the `reduce` built-in: [Python 2], 37 bytes f=lambda a,b:b-1and a(f(a,b-1),b)or 1 Try it online! (more) |
— | over 2 years ago |
Answer | — |
A: Multiply complex numbers. [Python 3], 98 bytes print(str(eval("("+input().replace(" ",")(").replace("i","j")+")")).strip("()").replace("j","i")) Try it online! Since the input format is restrictive, I may as well just spam replace and abuse `eval`. (more) |
— | almost 3 years ago |
Answer | — |
A: Evens or Odds - you know this one [Python 3], 10 bytes 1 .and Try it online! Returns `1` for odd numbers and `0` for even numbers. Two bytes shorter than the trivial `lambda x:x%2` and one byte shorter than the equivalent magic function `2 .rmod`. (more) |
— | almost 3 years ago |
Answer | — |
A: Are they abundant, deficient or perfect? [Jelly], 6 bytes ÆṣṠ)Ġ Try it online! In order of abundant, perfect, deficient. ``` ÆṣṠ)Ġ Main Link ) For each from 1 to N Subtract Æṣ The proper divisor sum Ṡ Sign of the difference Ġ Group equal elements' indices ``` (more) |
— | almost 3 years ago |
Answer | — |
A: Evaluation order of an APL n-train [Jelly], 8 bytes ṖUs2UṭµF Try it online! -1 byte thanks to caird coinheringaahing (Also posted on Stack Exchange by myself) ``` ṖUs2UṭµF Main Link Ṗ pop (remove last element; for numbers, comes with an implicit range) U reverse s2 slice into chun... (more) |
— | almost 3 years ago |
Answer | — |
A: Backspace an array [Python 3.8 (pre-release)], 62 bytes f=lambda x,a=[]:f(x[1:],a+[x[0]]if x[0]else a[:-1])if x else a Try it online! -11 bytes thanks to user (more) |
— | almost 3 years ago |
Answer | — |
A: Make my number a set [Python 3], 34 bytes f=lambda x:[f(y)for y in range(x)] Try it online! -9 bytes thanks to Moshi Unfortunately, I cannot use Python sets, because sets are unhashable and thus cannot be put into sets. (more) |
— | about 3 years ago |
Answer | — |
A: Cumulative Counts [APL (Dyalog Unicode)], 11 bytes (SBCS) 1 1∘⍉+\∘.=⍨ Try it online! This was a fun APL exercise. Working on figuring out how to get it down to 7 bytes. (more) |
— | about 3 years ago |
Answer | — |
A: Cumulative Counts [Jelly], 7 bytes =þ`ÄŒDḢ Try it online! (more) |
— | about 3 years ago |