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 Moshi‭

Type On... Excerpt Status Date
Edit Post #282430 Initial revision almost 3 years ago
Answer A: Evens or Odds - you know this one
[JavaScript (Node.js)], 6 bytes ```javascript n=>n%2 ``` Try it online! Basically does what you'd expect.
(more)
almost 3 years ago
Comment Post #281956 "Given an array consisting of positive integers" I kind of assumed that the positive integers are single digits because of your examples, but do I have to accept any positive integers?
(more)
almost 3 years ago
Comment Post #282319 @user Even if it's exclusive, $[A, B, C, D]$ are the elements 0, 1, 2, **3**; so it ends at 4 not 5. Not that it really matters though if you're changing it to any subset. Though if you'll allow any subset, what would the input be? An array and array of indices?
(more)
almost 3 years ago
Comment Post #282319 In any case, to address your questions: Plenty of languages have some sort of randomness function, it's probably fine to just leave the specification as (uniformly) random. This is not a dupe. Also, I personally find it interesting, so there's that.
(more)
almost 3 years ago
Comment Post #282319 Is there a mistake in your example? Given $[A, B, C, D, E, F, G, H]$, the 0th index is A and the 5th index is F, so the subset to shuffle would be $[A, B, C, D, E]$.
(more)
almost 3 years ago
Comment Post #280860 @Hakerh400 Thanks!
(more)
about 3 years ago
Edit Post #280860 Post edited:
about 3 years ago
Comment Post #280860 @rak1507 lol, does "looking it up" count as an answer to that question? You can derive it pretty easily though by simply assuming that it converges to $F_n(x+1)=rF_n(x)$ (where r is the ratio we want) and plugging it into recurrence equation.
(more)
about 3 years ago
Edit Post #280860 Post edited:
latex fix
about 3 years ago
Edit Post #280860 Initial revision about 3 years ago
Answer A: Ratio limits of fibonacci-like series
[JavaScript (Node.js)], 27 22 bytes -5 bytes thanks to Hakerh400‭ Direct computation ``` f=n=>(n+(nn+4).5)/2 ``` $$\frac{n+\sqrt{n^2+4}}{2}$$ Try it online!
(more)
about 3 years ago
Edit Post #280833 Post edited:
Update to make the solution valid
about 3 years ago
Comment Post #280829 Oops, I missed the output criteria. Is it fine to output truthy/falsey values instead of them necessarily being *exactly* two values? (If not, I'll go edit my answer, it's trivial to just tack on a boolean conversion)
(more)
about 3 years ago
Edit Post #280833 Initial revision about 3 years ago
Answer A: Is it a near-anagram?
[JavaScript (Node.js)], 131 bytes Returns true and false ```javascript g=(s,t,c=[...t])=>([...s].forEach(v=>(y=c.indexOf(v),c.splice(y,y>=0))),c) f=(s,t)=>(x=g(s,t).length)<2&&(y=g(t,s).length)<2&&x+y ``` Try it online! Explanation `g` computes a sort of set (Array?) difference betw...
(more)
about 3 years ago
Comment Post #279854 Is there a point to combining the two functionalities into one? I'm pretty sure that it basically means every answer will just have a `input[0]=='{'?xxx:yyy` (or equivalent) tacked to the front of it.
(more)
over 3 years ago
Edit Post #279812 Initial revision over 3 years ago
Answer A: Prime Difference
[JavaScript (Node.js)], 81 bytes ```javascript d=(p,i=2)=>id(p)?f(n,a,p+1):p-a d(p)?f(n, a, p + 1) // Recurse until p is prime // p starts at a+1 so it gets the prime after a :p-a<n?f(n, p):a // If a, p doesn't work, we already computed the next prime so i...
(more)
over 3 years ago
Comment Post #279778 Could you use a character other than ⌷ to separate the graphics? (It's hard for me to tell which side they are 'attached' to)
(more)
over 3 years ago
Comment Post #279755 "Write a program that halts due to error." Doesn't that mean that almost every programming language would be a solution? (E.g. in your ```main``` example, Java would be a legitimate robber answer since it also fails.)
(more)
over 3 years ago
Edit Post #279665 Post edited over 3 years ago
Suggested Edit Post #279665 Suggested edit:
Fixed table (have to leave an empty line before table markdown)
(more)
helpful over 3 years ago
Comment Post #279679 @Lundin Thanks for your suggestions!
(more)
over 3 years ago
Edit Post #279679 Post edited:
over 3 years ago
Edit Post #279679 Initial revision over 3 years ago
Answer A: Reverse an ASCII string
C, 66 59 bytes -7 bytes thanks to Lundin! In-place string reversal ```c f(chars){s[1]?f(s+1):0;for(char t=s;s[1];++s=t)s=s[1];} ``` Try it online!
(more)
over 3 years ago
Edit Post #279665 Post edited over 3 years ago
Suggested Edit Post #279665 Suggested edit:
Moved the table to a collapsible section
(more)
helpful over 3 years ago
Comment Post #279639 (Aside: to mention someone you have to put the full username, without spaces)
(more)
over 3 years ago
Comment Post #279639 @moony Suggest edits aren't really used for stuff like that; since there are a bunch of limitations (you can't suggest more than one edit, if you change your mind you can't edit your suggested edit, you can't partially incorporate edits etc.) It's much better to use the comments for these sorts of su...
(more)
over 3 years ago
Edit Post #279452 Post edited:
over 3 years ago
Edit Post #279452 Initial revision over 3 years ago
Answer A: Shape of an array
JavaScript (Node.js), 39 bytes Returns dimensions from innermost to outermost ```javascript f=a=>a?.pop?f(a[0]).concat(a.length):[] ``` JavaScript (Node.js), 41 bytes Returns dimensions from outermost to innermost ``` f=a=>a?.pop?[a.length].concat(f(a[0])):[] ```
(more)
over 3 years ago
Comment Post #279444 Is there an order we have to output in? (my solution outputs the dimensions in the reverse order of your test cases)
(more)
over 3 years ago
Edit Post #279256 Post edited:
over 3 years ago
Edit Post #279256 Initial revision over 3 years ago
Answer A: Length of a Sumac Sequence
[JavaScript (Node.js)], 27 25 bytes (-2 thanks to JoKing) ```javascript f=(a,b)=>a<0?0:1+f(b,a-b) ``` Try it online!
(more)
over 3 years ago
Edit Post #279255 Post edited over 3 years ago
Suggested Edit Post #279255 Suggested edit:

(more)
helpful over 3 years ago
Comment Post #279189 "that means that you can't just read the source file and print it" Does JavaScript "toString()" count as reading the source file?
(more)
over 3 years ago
Edit Post #279166 Post edited over 3 years ago
Suggested Edit Post #279166 Suggested edit:

(more)
helpful over 3 years ago