Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for Hakerh400‭

Type On... Excerpt Status Date
Comment Post #284501 The output for `("+-","",1)` should be `"++++++++++"` instead of `"++++++"`. Other test cases are ok.
(more)
over 2 years ago
Comment Post #284516 ... by assigning `c.length` to a variable.
(more)
over 2 years ago
Edit Post #284500 Post edited:
over 2 years ago
Edit Post #284500 Initial revision over 2 years ago
Answer A: Run-length encode a byte sequence
JavaScript (Node.js), 146 bytes f=(a,c=n=(b=d=[],e=x=>x&&(c>191|d>2?b.push(d+192,c):b.push(...d+n?[c,c]:[c]),c=n,d=0)))=>(a.map(b=>c^n?c=(e(d>62|b-c),d++,b):(c=b,d=1)),e(c-n),b) Try it online! Ungolfed version
(more)
over 2 years ago
Edit Post #284456 Initial revision over 2 years ago
Answer A: Find good coalitions
[Haskell], 141 bytes import Control.Monad f a=map(map fst)$filter(\c->let{g=map snd;e=sum(g a)`div`2;f=g c;d=sum f}in d>e&&all((<=e).(d-))f)$filterM(pure[1<0..])a Try it online! Explanation: we generate all possible coalitions and then filter out the bad ones. `filterM...
(more)
over 2 years ago
Edit Post #284422 Post edited:
over 2 years ago
Comment Post #284407 *"The returning value is the method that makes the equation true"* - but then you say: *"What to return when it's false? Something but not nothing (whitespaces and newlines aren't allowed as such output)"*. So, what is the type of the return value: a function, or a character?
(more)
over 2 years ago
Edit Post #284422 Post edited:
over 2 years ago
Edit Post #284422 Post edited:
over 2 years ago
Edit Post #284422 Post edited:
over 2 years ago
Edit Post #284422 Post edited:
over 2 years ago
Edit Post #284422 Initial revision over 2 years ago
Answer A: Encode and decode floating point integers
[Haskell], 219 194 bytes h!n=x n?(a?c$d>n&&(even a?f(x)[0..] (a?b)c|c=a|0<1=b Try it online! Depending on the first argument: False - Encode True - Decode
(more)
over 2 years ago
Edit Post #284189 Post edited:
over 2 years ago
Edit Post #284268 Post edited:
over 2 years ago
Comment Post #284277 [67 bytes](https://tio.run/##K6gsycjPM/7/nyvRVikztyC/qEQhqzg/z7qgKDOvRENdM1EjObUi1VpdGySql1KaW1CskagZbWWlaxirrW6bqK6pZA1UkAwU/P8fAA)
(more)
over 2 years ago
Comment Post #284271 Is an extra new line at the end allowed?
(more)
over 2 years ago
Edit Post #284276 Initial revision over 2 years ago
Answer A: Reverse your quine
JavaScript (Node.js), 60 bytes f=a=&gt;console.log(`)(f;${[...f+``].reverse``.join``}=f`);f() Try it online!
(more)
over 2 years ago
Edit Post #284275 Initial revision over 2 years ago
Answer A: Reverse your quine
[Haskell], 78 bytes main=putStr$reverse$a++show a where a="main=putStr$reverse$a++show a where a=" Try it online!
(more)
over 2 years ago
Edit Post #284268 Initial revision over 2 years ago
Answer A: The Ludic Numbers
[Haskell], 51 49 bytes -2 bytes thanks to Wheat Wizard 1:g[2..] g(a:b)=a:g[d|(c,d)0] Try it online!
(more)
over 2 years ago
Comment Post #284191 Are function answers allowed? Or does it have to be a full program?
(more)
over 2 years ago
Comment Post #284195 [42 bytes](https://tio.run/##PcpBCsIwFEXReVbxKAiJjchvZ4UuJrWJBuprSTLpBlyAS@xGok68swN328tjZV9rGBf3nGYHDryI4wxpg@7PbCUG8NT5JXvw2plafC43l33GiOR491osRIxSYU0gIvFfBoVvW4osmhbN8Xo3Fj8FTWOMqh8)
(more)
over 2 years ago
Edit Post #284189 Initial revision over 2 years ago
Answer A: Collatz conjecture; Count the tries to reach $1$
[Haskell], 43 39 bytes f 1=0 f n=1+f([div n 2,n3+1]!!mod n 2) Try it online!
(more)
over 2 years ago
Edit Post #284172 Post edited:
over 2 years ago
Edit Post #284181 Post edited:
over 2 years ago
Edit Post #284181 Initial revision over 2 years ago
Answer A: Decode periodic decimal fractions
[Haskell], 352 bytes f a=let{(d,e)=y$filter(>'-')a;f=drop 1e;g=0!h;h=fst n;i=scanr(:)[]h;(j,k)=elem '.'f%(1!head(filter(\a->a>[]&&elem(a++a)i)i++[[last$'0':h]]));(l,m)=(read('0':d)::Integer,1)#g#(j,ksnd g);n=y f}in(last$l:[-l|elem '-'a],m) y=break([])%(read b,10^length b-a) (a,b)...
(more)
over 2 years ago
Edit Post #284172 Initial revision over 2 years ago
Answer A: Abbreviate everything
[Haskell], 139 138 bytes import Data.Char f(a:b)|d a=toUpper a:f(dropWhile(\a->e a"-'"||d a)b)|e a":;"=a:c|e a".?!"=' ':c|0<1=c where c=f b;d=isLetter;e=elem f a=a Try it online!
(more)
over 2 years ago
Edit Post #284166 Initial revision over 2 years ago
Article Play dominoes using strings
Challenge Given two lists of strings $A$ and $B$, both of length $n\ge1$. For any $i\in\left\\\{1,\dots,n\right\\\}$, by $Ai$ and $Bi$ we represent the $i$-th string from $A$ and $B$, respectively. Associative infix binary operator $+$ represents string concatenation. Output any $k1,\dots,km$ f...
(more)
over 2 years ago
Comment Post #284136 `"+2"` is `2/1`, not `2/2`. Also, `".122122..."` is `122/999`, not `211/999`
(more)
over 2 years ago
Comment Post #284136 `611107811/4950` should be negative. Can you also add `-0`, `-.`, and a few test cases with explicit `+`?
(more)
over 2 years ago
Edit Post #284130 Initial revision over 2 years ago
Answer A: Expand a polynomial
[Haskell], 45 bytes foldl(\a b->zipWith((-).(b))(0:a)$a++[0])[1] Try it online! Uses the "highest power first" convention. Sometimes multiplies the polynomial by $(-1)$.
(more)
over 2 years ago
Edit Post #284094 Initial revision over 2 years ago
Answer A: Repeat the characters
[Haskell], 18 bytes (.replicate).(>>=) Try it online!
(more)
over 2 years ago
Edit Post #284070 Initial revision over 2 years ago
Answer A: Digit Sum Integer Sequence (working title)
[Haskell], 56 bytes f a=a:f(a+g(read.pureshow a)) g a=minimum a+maximum a Try it online!
(more)
over 2 years ago
Comment Post #284040 Test cases 5, 9 and 10 seem incorrect.
(more)
over 2 years ago
Edit Post #284042 Post edited:
over 2 years ago
Edit Post #284042 Initial revision over 2 years ago
Answer A: "Hello, {name}!"
[Haskell], 43 35 bytes main=interact$("Hello, "++).(++"!") Try it online!
(more)
over 2 years ago
Edit Post #284027 Initial revision over 2 years ago