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 »

Search

Advanced Search Options

To further refine your search, you can use additional qualifiers such as score:>0.5. For example, the search score:>=0.5 created:<1y grammar would return only posts mentioning "grammar" that have a score >= 0.5 and were created less than a year ago.

Further help with searching is available in the help center.

Quick hints: tag:tagname, user:xxx, "exact phrase", post_type:xxx, created:<N{d,w,mo,y}, score:>=0.5

Filters
1.6k posts
 
50%
+0 −0
50%
+0 −0
Challenges Make a frequency table (histogram)

JavaScript (Node.js), 38 32 bytes -6 bytes thanks to Shaggy! a=>a.map(v=>d[v]=-~d[v],d={})&&d Try it online! Basically just this but returning the result

posted 2y ago by Moshi‭  ·  edited 2y ago by Moshi‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

APL(Dyalog Unicode), 4 bytes SBCS Anonymous tacit prefix function. ,∘≢⌸ Try it on APLgolf! …⌸ between each unique element and its indices, apply: ,∘≢ concatenate the unique element to the ta...

posted 2y ago by Adám‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

C (gcc), 45, 42 bytes t[9999];f(s,a)int*a;{for(;s;)t[a[--s]]++;} Try it online! Assumptions: Passing the array size to a function can be used as a means to deal with empty arrays (not s...

posted 2y ago by Lundin‭  ·  edited 2y ago by Lundin‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

Lua, 98 bytes function(t)r={}for k,v in pairs(t)do r[v]=0 end for k,v in pairs(t)do r[v]=r[v]+1 end return r end Attempt This Online!

posted 2y ago by Zakk‭

Answer
50%
+0 −0
Challenges Cumulative Counts

J, 24 char ([: +/ [: (* +/\ )"1 ~. ="0 1 ]) Sample Runs ([:+/[:(*+/\)"1~.="0 1]) 1 1 2 2 2 1 1 1 3 3 1 2 1 2 3 3 4 5 1 2 ([:+/[:(*+/\)"1~.="0 1]) 3 7 5 4 9 2 3 2 6 6 1 1 1 1 1 1 2 ...

posted 2y ago by torres‭

Answer
50%
+0 −0
Challenges Cumulative Counts

J, 9 bytes 1#.]=&><\ This is the 7 byte APL solve but makes use of #. in place of +/"1. I came up with 1#.]=[\ first, but bubbler pointed out it breaks when non zeros are present. At...

posted 2y ago by south‭

Answer
50%
+0 −0
Challenges Cumulative Counts

Python 3.8 (pre-release), 69 bytes def f(x,y={},z=[]): for i in x:y[i]=y.get(i,0)+1;z+=[y[i]] return z Try it online! Bonus: theoretical answer if python allowed named assignment with su...

posted 2y ago by dino‭  ·  edited 2y ago by dino‭

Answer
50%
+0 −0
Challenges Cumulative Counts

Python 3, 74 bytes def f(a): d={x:0 for x in a};r=[] for x in a:d[x]+=1;r+=[d[x]] return r Try it online!

posted 2y ago by celtschk‭

Answer
50%
+0 −0
Challenges Evens or Odds - you know this one

Myby, 2 bytes %2 Input is taken from the command line implicitly. 0 for even, 1 for odd. Since Myby is still in its early stages, there is no online sandbox. Some test cases can be seen here.

posted 2y ago by south‭

Answer
50%
+0 −0
Challenges Evens or Odds - you know this one

ESCR, 17 bytes show [and [in] 1] ESCR has no way to read from standard input (currently), so I assumed the existence of the function IN which magically returns the user input. Since the user i...

posted 2y ago by Olin Lathrop‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

Vyxal, 1 byte Ċ Try it Online! Yes, there really is a built-in for this.

posted 2y ago by lyxal‭

Answer
50%
+0 −0
Challenges Cumulative Counts

Vyxal, 4 bytes KƛtO Try it Online! Explained KƛtO Kƛ # For each prefix of the input tO # How many times does the tail occur in the prefix?

posted 2y ago by lyxal‭

Answer
50%
+0 −0
Challenges Determine whether an integer is square-free

Factor, 108 bytes USING: assocs kernel math math.primes.factors ; IN: s : ? ( n -- ? ) group-factors [ nip 2 < ] assoc-all? ;

posted 2y ago by gifti‭  ·  edited 2y ago by gifti‭

Answer
50%
+0 −0
Challenges Cumulative Counts

Factor, 122 bytes USING: kernel sequences sequences.windowed ; IN: c : c ( s -- s ) dup length [ dup last [ = ] curry count ] rolling-map ;

posted 2y ago by gifti‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

Ruby, 12 bytes ->{_1.tally} Attempt it online!

posted 2y ago by south‭

Answer
50%
+0 −0
Challenges Partial Sums of Harmonic Series

Goruby, 38 bytes ->n{dw{$.+=1;$..mp{1.0/-~_1}.su<n};$.} This was not as much fun as I thought it would be, but it was fun enough to use once.

posted 2y ago by south‭

Answer
50%
+0 −0
Challenges Cumulative Counts

Python 3, 70 bytes def f(a): d={};r=[] for x in a:d[x]=d.get(x,0)+1;r+=[d[x]] return r Try it online!

posted 2y ago by __blackjack__‭

Answer
50%
+0 −0
Sandbox Mark my beacons

posted 2y ago by Razetime‭

Article code-golf matrix
50%
+0 −0
Challenges Find n Niven Numbers

Japt, 10 bytes ÈvXìx}jU1ì Try it

posted 2y ago by Shaggy‭

Answer
50%
+0 −0
Challenges Make a frequency table (histogram)

Japt, 8 bytes ü ®â pZl Try it

posted 2y ago by Shaggy‭

Answer
50%
+0 −0
Challenges Create a range grid

Japt -m, 4 bytes VÆT° Try it

posted 2y ago by Shaggy‭

Answer
50%
+1 −1
Meta Filtering the sandbox for ease of feedback

Both tags and [FINALIZED] are problematic Problem with tags Having been shown the related meta post Separate the tags away from the Sandbox or delete the [finalized] tag I can now see that having...

posted 2y ago by trichoplax‭  ·  edited 2y ago by trichoplax‭

Answer
50%
+0 −0
Challenges "Hello, World!"

Z80 Assembler, 50 bytes org 256 ld de,m ld c,9 jp 5 m:db"Hello, world!\r$" With assembler there's usually the problem which machine or operating system the program is for. I've chosen CP/M ...

posted 2y ago by __blackjack__‭

Answer
50%
+0 −0
Challenges Presumptuous base conversion

C (gcc), 117 bytes b,r;f(char*s){char*p=s;for(;*p;p++)*p-=47+7*(*p>57),b=b<*p?*p:b;if(b<2)return p-s;for(;*s;s++)r*=b,r+=*s-1;return r;} Try it online!

posted 2y ago by celtschk‭

Answer