Activity for radarekā
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #285592 |
Post edited: |
— | over 2 years ago |
Edit | Post #286079 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Solve Goldbach's Conjecture Ruby, 62 bytes require'prime';f=->n,k=0{n.prime?&&k.prime?? [n,k]:f[n-1,k+1]} Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285629 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285629 |
Post edited: |
— | almost 3 years ago |
Comment | Post #285743 |
@#53310 Thanks for spotting it. Fixed. (more) |
— | almost 3 years ago |
Edit | Post #285743 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285743 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Golf a FRACTRAN interpreter Ruby, 44 bytes ->p,n{n=I while I=p.find{1n%1==0};n.toi} Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285708 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Stairs? Stairs! Stairs. Ruby, 50 bytes ->n{n.times{puts (' '(n-1)+'/'+'##'1)[3..]}} Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285496 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285707 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Operation "Find The Operator" Ruby, 57 bytes ->a,b,c{%w[+ - / % ].select{c==a.send(1,b)rescue p}} Attempt This Online! (more) |
— | almost 3 years ago |
Comment | Post #285331 |
However, your code and mine suggestion don't work with input `*,0,*` (division by 0). The error must by properly handled. (more) |
— | almost 3 years ago |
Comment | Post #285692 |
Unfortunately this does not work for input 0, 2 and 0, 2.
```
f=->a,b{a|b==2?5:a+b}
f[0, 2] # => 5
``` (more) |
— | almost 3 years ago |
Edit | Post #285706 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Make $2 + 2 = 5$ Ruby, 20 bytes ->a,b{4[a]4[b]+a+b} Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285592 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285605 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285496 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285668 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285668 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Given the preorder and the inorder of a tree, output the postorder Ruby, 75 72 bytes f=->((e,r),n){(i=n.index e)?f[r[0,i],n[...i]]+f[r[i..],n[i+1..]]+[e]:n} Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285667 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Compute the determinant Ruby, 35 bytes ->m{require'matrix';Matrix[m].det} Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285618 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285659 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Prime Difference Ruby, 56 bytes ```ruby ->n{require'prime';Prime.eachcons(2).find{2-1>=n}[0]} ``` Attempt This Online! (more) |
— | almost 3 years ago |
Edit | Post #285630 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285630 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285629 |
Post edited: |
— | almost 3 years ago |
Comment | Post #283012 |
@#53607 Ok, make sense. (more) |
— | almost 3 years ago |
Comment | Post #285618 |
@#55346 nice catch! Thanks. (more) |
— | almost 3 years ago |
Edit | Post #285655 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285655 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285655 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285655 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Merge two strings Ruby, 40 bytes ```ruby f=->a,b{b.index(a)==0?b:a[/./m]+f[$',b]} ``` Attempt This Online! If we could assume that string contains only letters and numbers (or to be more specific, no characters like `\t\n\v\f\r \#$()+-.?[\\]^{|}`) then it could be improved to 36 bytes: ```ruby f=->a,b{b... (more) |
— | almost 3 years ago |
Comment | Post #281542 |
What characters can strings include? Only letters (like in examples)? New lines can be included? What about other characters? (more) |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285622 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285632 | Initial revision | — | almost 3 years ago |
Answer | — |
A: A number adder, not a death adder Ruby, 25 bytes ```ruby puts"p #{gets}+gets.toi" ``` P1 - Try this online! P2 - Try this online! (more) |
— | almost 3 years ago |